Tricky import question.
Bengt Richter
bokr at oz.net
Tue Oct 25 16:09:22 EDT 2005
On 25 Oct 2005 08:51:08 -0700, "David Poundall" <david at jotax.com> wrote:
>This worked ...
>
>def my_import(name):
> mod = __import__(name)
> components = name.split('.')
> for comp in components[1:]:
> mod = getattr(mod, comp)
> return mod
>
>for reasons given here...
>
>http://www.python.org/doc/2.3.5/lib/built-in-funcs.html
>
Aha. You didn't mention multi-dot names ;-)
But was that the real problem? Your original code
wasn't using anything corresponding to mod above.
Regards,
Bengt Richter
More information about the Python-list
mailing list