execfile(), import and namespaces

Gordon McMillan gmcm at hypernet.com
Fri Jul 2 16:22:44 EDT 1999


Nikolas Kauer wrote:

> We use a modification of "Listing One" of Andrew Kuchling's "A CGI
> Framework in Python" article in Web Techniques (February 1998) for
> our dynamic Web site. [...]  The object files would be loaded as
> modules with 'import'.
> 
> Problem: In the following code snipet environment variables are
> passed to the executed Python file via the corresponding global
> namespace argument of the execfile() function; whereas the 'import'
> statement does not allow for such arguments.

But __import__ does. Check the library docs under built-in-functions.

- Gordon




More information about the Python-list mailing list