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: imp.find_module doesn't work in /tmp
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.5
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: brett.cannon Nosy List: akuchling, brett.cannon, vng1
Priority: normal Keywords:

Created on 2003-09-19 13:44 by vng1, last changed 2022-04-10 16:11 by admin. This issue is now closed.

Messages (6)
msg18227 - (view) Author: Victor T. Ng (vng1) Date: 2003-09-19 13:44
I'm running OSX 10.2.6 and the imp module seems to 
have a parsing error when I pass it the directory "/"

bash$ cd /tmp
bash$ touch __init__.py
bash$ python
Python 2.3 (#2, Jul 30 2003, 11:45:28) 
[GCC 3.1 20020420 (prerelease)] on darwin
Type "help", "copyright", "credits" or "license" for more 
information.
>>> import imp
>>> imp.find_module("tmp",['/'])
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: No module named tmp
>>> imp.find_module("tmp",['//'])
(None, '//tmp', ('', '', 5))

I'm not sure why, but I seem to need a double slash in the 
directory name.
msg18228 - (view) Author: Victor T. Ng (vng1) Date: 2005-01-11 00:29
Logged In: YES 
user_id=679596

lima:~ buildbox$ cd /tmp
lima:/tmp buildbox$ touch __init__.py
lima:/tmp buildbox$ python
Python 2.3 (#1, Sep 13 2003, 00:49:11) 
[GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin
Type "help", "copyright", "credits" or "license" for more
information.
>>> import imp
>>> imp.find_module("tmp", ['/'])
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: No module named tmp
>>> 
msg18229 - (view) Author: Victor T. Ng (vng1) Date: 2005-01-11 00:31
Logged In: YES 
user_id=679596

Affects both Python 2.3 and Python 2.4 on OSX:

Python 2.4 (#1, Dec 25 2004, 15:45:34) 
[GCC 3.3 20030304 (Apple Computer, Inc. build 1671)] on darwin
Type "help", "copyright", "credits" or "license" for more
information.
>>> import imp
>>> imp.find_module('tmp', ['/'])
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: No module named tmp
>>> 
msg18230 - (view) Author: Victor T. Ng (vng1) Date: 2005-01-11 00:32
Logged In: YES 
user_id=679596

No problems under Python 2.4 on Linux:

Python 2.4 (#3, Dec 29 2004, 10:03:34) 
[GCC 3.3.4 (Debian 1:3.3.4-13)] on linux2
Type "help", "copyright", "credits" or "license" for more
information.
>>> import imp
>>> imp.find_module('tmp',['/'])
(None, '/tmp', ('', '', 5))
>>> 
msg18231 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2006-08-03 13:42
Logged In: YES 
user_id=11375

Still present in 2.5 on MacOS; still not present on Linux.
msg85157 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2009-04-02 04:10
It's because /tmp on OS X is a symlink to /private/tmp. Works fine if
you specify /private as the search path.
History
Date User Action Args
2022-04-10 16:11:14adminsetgithub: 39259
2009-04-02 04:10:53brett.cannonsetstatus: open -> closed
resolution: not a bug
messages: + msg85157
2009-02-11 02:51:41ajaksu2setassignee: brett.cannon
type: behavior
nosy: + brett.cannon
2003-09-19 13:44:28vng1create