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 with a dot in the filename don't load
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 2.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: ezio.melotti, giunghi
Priority: normal Keywords:

Created on 2010-04-14 13:15 by giunghi, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg103127 - (view) Author: marco stamazza (giunghi) Date: 2010-04-14 13:15
On my windows Xp system running Python 2.6 (from the (x,y) package) I tried to load a module named "GetMy.com_MOD.py". I kept receiving the error 
Traceback (most recent call last):
  File "D:\Docs\Futures-Strategy\StCHF\Test\GetMy.com_2.py", line 6, in <module>
    import GetMy.com_MOD
ImportError: No module named GetMy.com_MOD

Until I removed the dot renaming it to GetMycom_MOD.py, which works very nicely. Maybe the search should be smart enough to look for the last word after a dot to determine if the module exists or not?

Many thanks guys, Python rocks. marco
msg103129 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2010-04-14 13:26
If you do "import GetMy.com_MOD" Python will search for the module named "com_MOD" in the package "GetMy".
The name of the module should be a valid Python identifier -- possibly all lowercase (see PEP8). GetMy.com_MOD is not a valid identifier, so you wouldn't even be able to do GetMy.com_MOD.some_func() once you imported it.

See http://docs.python.org/reference/simple_stmts.html#the-import-statement for more information.
History
Date User Action Args
2022-04-11 14:56:59adminsetgithub: 52645
2010-04-14 13:26:56ezio.melottisetstatus: open -> closed

nosy: + ezio.melotti
messages: + msg103129

resolution: not a bug
stage: resolved
2010-04-14 13:15:00giunghicreate