How to instatiate a class of which the name is only known at runtime?
Wed Sep 10 21:37:38 CEST 2003
On Tue, Sep 09, 2003 at 12:56:25PM -0700, Gary Herron wrote:
> The imp module has what you want.
I already found the imp module and thought it was what I was searching
for, but it didn't work to me as I expected.
> find_module(name[, path])
> Try to find the module name on the search path path.
That didn't work, because I didn't know how to specify the path. It
always said something about "ImportError: No frozen submodule".
> load_module(name, file, filename, description)
> Load a module that was previously found by find_module()
I also tried this, but didn't know how to use it. I didn't know what the
parameters mean and the doc wasn't verbose enough to me.
But the way Nick and Chad pointed to me are totally perfect in my case.
So I will use these.
Ein fester Satz an Vorurteilen ist ausgesprochen praktisch. Er
erspart einem das Nachdenken.
Marco Herrn herrn at gmx.net
(GnuPG/PGP-signed and crypted mail preferred)
Key ID: 0x94620736
More information about the Python-list