[python-win32] execfile question

magic joe joe_magic at skynet.be
Tue Nov 23 22:53:08 CET 2004


I have a program generating dynamic code which is then launched with :

execfile(file_out)

However generated import statements appear not to work, only the modules
that are imported in the program doing the exec call are recognized.
How can I fix this ? (Well one way is importing everything in the calling
module but that is a little bit ugly and may lead to huge load time )



ie:
file contains:

import time
def f:
    return time.localtime()                  # 43
NameError: global name 'time' is not defined
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.786 / Virus Database: 532 - Release Date: 29/10/2004



More information about the Python-win32 mailing list