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

SourceForge.net noreply at sourceforge.net
Sun May 28 22:11:54 CEST 2006


Bugs item #1496539, was opened at 2006-05-28 19:57
Message generated for change (Comment added) made by gbrandl
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: Closed
>Resolution: Fixed
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.

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

>Comment By: Georg Brandl (gbrandl)
Date: 2006-05-28 20:11

Message:
Logged In: YES 
user_id=849994

This was actually sitting around in my local trunk, having
fixed it on the plane :)
Thanks for reminding me, checked in the fix in rev. 46508.

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

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