This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: current directory added to sys.path on win32
Type: Stage:
Components: Interpreter Core Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: jpe, loewis
Priority: normal Keywords:

Created on 2006-07-22 00:27 by jpe, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg29250 - (view) Author: John Ehresman (jpe) * Date: 2006-07-22 00:27
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 "".
msg29251 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2006-07-24 11:47
Logged In: YES 
user_id=21627

This is fixed with patch #1232023.
History
Date User Action Args
2022-04-11 14:56:19adminsetgithub: 43707
2006-07-22 00:27:04jpecreate