glomde wrote: > Hi, > > I want to create a function that preprocesses a file and then imports > the parsed file. > > What I found out is that you can do something like this: > > def ImportFile(fileName): > parsedCode = Parser(fileName).Parse() > module = new.module(name) > exec parsedCode in module.__dict__ > sys.modules[name] = module > import name > > But this works only if the ImportFile isnt loaded from a module. > Since the import is local.
Look for __import__() (it's in the builtins) and sys.modules. -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')])" -- http://mail.python.org/mailman/listinfo/python-list