Hallöchen!

[EMAIL PROTECTED] writes:

> I'm playing with some mod_python and web development. And in me
> code I need to do som dynamic imports.  Right now I just do a:
>
> exec 'import '+some_modulename
>
> But it seems to easy, is there a "dark side" to doing it this way?
> (memory use,processing ,etc) And have to I check if the modul is
> already loaded?

I use the imp module for this:

try:
    file, pathname, description = imp.find_module(full_name)
    my_module = imp.load_module(full_name, file, pathname, description)
finally:
    file.close()

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
                                      Jabber ID: [EMAIL PROTECTED]
               (See http://ime.webhop.org for further contact info.)
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to