[ python-Bugs-1496539 ] Modules in cwd can't be imported in interactive mode

SourceForge.net noreply at sourceforge.net
Sun May 28 21:57:35 CEST 2006


Bugs item #1496539, was opened at 2006-05-28 21:57
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1496539&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: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Žiga Seilnacht (zseil)
Assigned to: Nobody/Anonymous (nobody)
Summary: Modules in cwd can't be imported in interactive mode

Initial Comment:
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.

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

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


More information about the Python-bugs-list mailing list