Hi,
I am using the builtin __import__() to import modules. That works for
simple modules like in this example:
m= __import__("egg s")
when there is the module "eggs.py" in the current directory
But how do I do this with packages? A I understand the documentation for
__import__(), it must be something like:
m= __import__("egg s", globals(), locals(), ["spam"])
when there is the package "spam" in the current directory, containing
the module "eggs".
But that doesn't work. I tried it in some different forms. The only one
that works in some way is:
m= __import__("spa m.eggs")
But that is not what I want, since I get "spam" as a module:
<module 'spam' from 'spam/__init__.pyc'>
So what am I doing wrong here?
Marco
--
Marco Herrn herrn@gmx.net
(GnuPG/PGP-signed and crypted mail preferred)
Key ID: 0x94620736
I am using the builtin __import__() to import modules. That works for
simple modules like in this example:
m= __import__("egg s")
when there is the module "eggs.py" in the current directory
But how do I do this with packages? A I understand the documentation for
__import__(), it must be something like:
m= __import__("egg s", globals(), locals(), ["spam"])
when there is the package "spam" in the current directory, containing
the module "eggs".
But that doesn't work. I tried it in some different forms. The only one
that works in some way is:
m= __import__("spa m.eggs")
But that is not what I want, since I get "spam" as a module:
<module 'spam' from 'spam/__init__.pyc'>
So what am I doing wrong here?
Marco
--
Marco Herrn herrn@gmx.net
(GnuPG/PGP-signed and crypted mail preferred)
Key ID: 0x94620736
Comment