Question about namespaces and import. How to avoid calling os.system

Patricia J. Hawkins phawkins at connact.com
Fri Jul 22 22:30:31 EDT 2005


>>>>> "PN" == Pekka Niiranen <pekka.niiranen at wlanmail.com> writes:

PN> Hi there,
PN> I have two scripts. The first "main.py" sets some variables
PN> and then imports another called "gen.py". The idea is to
PN> provide "main.py" that defines some paths, variables etc.
PN> without using Windows environment variables. Various other "hackers"
PN> will make additional Python scripts (subroutines) like "gen.py"
PN> that utilize variables set by the "main.py" and which "main.py" calls.
PN> I can do this with "subprocess" module by setting its env -variable
PN> but I try to avoid calling shell. How can I merge temporary
PN> the namespaces of the two modules?

The built-in execfile should do the trick.

-- 
Patricia J. Hawkins
Hawkins Internet Applications
www.hawkinsia.com



More information about the Python-list mailing list