[ python-Bugs-1526785 ] current directory added to sys.path on win32

SourceForge.net noreply at sourceforge.net
Mon Jul 24 13:47:17 CEST 2006


Bugs item #1526785, was opened at 2006-07-22 02:27
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1526785&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: John Ehresman (jpe)
Assigned to: Nobody/Anonymous (nobody)
Summary: current directory added to sys.path on win32

Initial Comment:
The current directory at the time python starts is
added to sys.path as the 3rd item (usually), regardless
of whether the python file run is in this directory. 
This is apparently due to getpythonregpath in
getpathp.c returning "" when skiphome is true and there
are 0 subkeys in the registry.  Since this is != NULL,
it is appended to the path after the library zip file
is and later is expanded to the current directory.

Because of this, 'import string' fails when an empty
re.py is in the current directory because this file is
used when string tries to import re.  I know it's not a
good idea to have an empty re.py file, but I can't
control what's on other people's machines.

I've been debugging this in python 2.4, but 2.5 beta 2
seems to have the same behavior.  This fix may be to
set machinepath and userpath to NULL if they are "".

----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2006-07-24 13:47

Message:
Logged In: YES 
user_id=21627

This is fixed with patch #1232023.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1526785&group_id=5470


More information about the Python-bugs-list mailing list