[issue8398] Modules with a dot in the filename don't load

2010-04-14 Thread Ezio Melotti

Ezio Melotti  added the comment:

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.

--
nosy: +ezio.melotti
resolution:  -> invalid
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8398] Modules with a dot in the filename don't load

2010-04-14 Thread marco stamazza

New submission from marco stamazza :

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 
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

--
components: Interpreter Core
messages: 103127
nosy: giunghi
severity: normal
status: open
title: Modules with a dot in the filename don't load
type: behavior
versions: Python 2.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com