Python puts an empty string as the first
element of sys.path when the script directory is
not available. Starting with revision 46372
this entry isn't interpreted as a marker for
the current working directory any more.
Windows doesn't have this problem, since
current directory is explicitly inserted
into sys.path.
How to reproduce:
Python 2.5a2 (trunk:46372M, May 28 2006, 21:29:19)
[GCC 4.1.0 (SUSE Linux)] on linux2
Type "help", "copyright", "credits" or "license"
for more information.
>>> import os
>>> import sys
>>> os.listdir(os.getcwd())
['mymodule.pyc', 'mymodule.py']
>>> import mymodule
Traceback (most recent call last):
...
ImportError: No module named mymodule
>>> sys.path_importer_cache[''] = True
>>> import mymodule
>>>
I tested with revisions 46371, 46372 and
46504. The problem is not present in
revision 46371, but is still present
in 46504.
|