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.

Author vstinner
Recipients vstinner
Date 2009-02-26.15:56:32
SpamBayes Score 0.00013018837
Marked as misclassified No
Message-id <1235663793.95.0.193952339163.issue5376@psf.upfronthosting.co.za>
In-reply-to
Content
__import__() raises an ImportError "No module named ..." if the module 
file is not readable or module directory is not executable. The 
expected message is something like "Module named ... is not readable".

Directory tree for the test:
------------------------------
marge$ ls -lRF .
.:
drwxrwxrwx 2 haypo haypo 4096 2009-02-26 16:51 module/
-rw-rw-rw- 1 haypo haypo    9 2009-02-26 16:48 module2.py
-rw-r--r-- 1 haypo haypo  414 2009-02-26 16:50 test.py

./module:
-rw-r--r-- 1 haypo haypo 10 2009-02-26 16:45 __init__.py
------------------------------

Success with correct file permissions:
------------------------------
$ python test.py
__import__('/home/haypo/xxx/module') ...
PI = 3.14
__import__('/home/haypo/xxx/module2') ...
E = 2.72
------------------------------

Change module/ and module2.py permissions to 000 (no read, no write, 
no execute):
------------------------------
__import__('/home/haypo/xxx/module') ...
No module named /home/haypo/xxx/module
__import__('/home/haypo/xxx/module2') ...
No module named /home/haypo/xxx/module2
------------------------------
History
Date User Action Args
2009-02-26 15:56:34vstinnersetrecipients: + vstinner
2009-02-26 15:56:33vstinnersetmessageid: <1235663793.95.0.193952339163.issue5376@psf.upfronthosting.co.za>
2009-02-26 15:56:32vstinnerlinkissue5376 messages
2009-02-26 15:56:32vstinnercreate