Help: Trouble with imp.load_module
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Mon Dec 17 02:50:22 EST 2007
En Tue, 11 Dec 2007 16:09:22 -0300, David Hirschfield <davidh at ilm.com>
escribi�:
> So this must have something to do with the "." in the name of module
> "test.B.py" but what is the problem, exactly? And how do I solve it? I
> will sometimes need to run load_module on filenames which happen to have
> "." in the name somewhere other than the ".py" extension. Is the
> find_module somehow thinking this is a package?
Module names must be identifiers (see section 6.12 in the Python Reference
Manual) so test.B *cannot* be a module name. Just avoid such names as
module names; if you know where the file is located, call load_module
directly with an already open file and a fake module name.
--
Gabriel Genellina
More information about the Python-list
mailing list