[Chicago] exec saved compiled code
Massimo Di Pierro
mdipierro at cti.depaul.edu
Wed Aug 29 08:54:04 CEST 2007
Hello,
I am hoping one of you can help me with this.
EXAMPLE:
environment={'x':3}
open('a.py','w').write('print x')
import py_compile,os
exec(open('a.py','r').read()) in environment ### prints 3 OK!
py_compile.compile('a.py')
os.unlink('a.py')
exec(open('a.pyc','r').read()) in environment ### does not work
QUESTION: how do exec a.pyc into environment so that it prints 3? Is
it possible to do it?
Massimo
More information about the Chicago
mailing list