When we run setup, we get an error immediately after the data files get copied to the dist directory:
error: compiling '__main__.py' failed`
SyntaxError: unqualified exec is not allowed in function '_chainload' it contains a nested function with free variables (__main__.py, line 838)`
So I dug into f_py2exe.py and pulled out the __main__.py that is being generated. Line 838 is in load_resource():
for code in codelist:
exec(code, d_globals, d_locals)`
Digging even further in, it seems this is a difference in how Python 3.x handles exec() vs how Python 2.x handles exec().
for code in codelist:
exec code in d_globals, d_locals
fixed the problem. Mind you the same doc page says that exec(expr, globals, locals) is equivalent to exec expr in globals, locals but clearly it's not.
Python 2.7.5, esky 0.9.9, py2exe 0.6.9 on Win32
When we run setup, we get an error immediately after the data files get copied to the dist directory:
So I dug into f_py2exe.py and pulled out the
__main__.py
that is being generated. Line 838 is inload_resource()
:Digging even further in, it seems this is a difference in how Python 3.x handles exec() vs how Python 2.x handles exec().
After consulting the Python 2.x documentation page for the exec statement, changing those lines to:
fixed the problem. Mind you the same doc page says that
exec(expr, globals, locals)
is equivalent toexec expr in globals, locals
but clearly it's not.