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 Arfrever
Recipients Arfrever
Date 2011-09-25.19:03:50
SpamBayes Score 2.9853342e-10
Marked as misclassified No
Message-id <1316977431.22.0.335405032353.issue13046@psf.upfronthosting.co.za>
In-reply-to
Content
imp.find_module() can find files, which cannot be imported. I suggest that imp.find_module() raise an exception in such cases.

$ cd /tmp
$ touch .something.py
$ python3.3
Python 3.3.0a0 (default:5e456e1a9e8c+, Sep 25 2011, 18:57:23) 
[GCC 4.5.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import .something
  File "<stdin>", line 1
    import .something
           ^
SyntaxError: invalid syntax
>>> module = __import__(".something")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: Empty module name
>>> import imp
>>> file, pathname, description = imp.find_module(".something")
>>> file, pathname, description
(<_io.TextIOWrapper name=4 mode='U' encoding='utf-8'>, '.something.py', ('.py', 'U', 1))
History
Date User Action Args
2011-09-25 19:03:51Arfreversetrecipients: + Arfrever
2011-09-25 19:03:51Arfreversetmessageid: <1316977431.22.0.335405032353.issue13046@psf.upfronthosting.co.za>
2011-09-25 19:03:50Arfreverlinkissue13046 messages
2011-09-25 19:03:50Arfrevercreate