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: Modules in cwd can't be imported in interactive mode
Type: Stage:
Components: Interpreter Core Versions: Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, zseil
Priority: normal Keywords:

Created on 2006-05-28 19:57 by zseil, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg28675 - (view) Author: Ziga Seilnacht (zseil) * (Python committer) Date: 2006-05-28 19:57
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.
msg28676 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-05-28 20:11
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.
History
Date User Action Args
2022-04-11 14:56:17adminsetgithub: 43427
2006-05-28 19:57:30zseilcreate