Issue 204 in mpmath: py2exe compile error for exec_py3.py - on python 2.7.1

109 views
Skip to first unread message

mpm...@googlecode.com

unread,
Feb 4, 2011, 5:34:19 AM2/4/11
to mpmath...@googlegroups.com
Status: New
Owner: ----

New issue 204 by Vlastimi...@gmail.com: py2exe compile error for
exec_py3.py - on python 2.7.1
http://code.google.com/p/mpmath/issues/detail?id=204

Hi all,
I just wanted to report one issue I encountered while trying mpmath 0.17
with py2exe, which probably arose with the added py3 support.
I am using python 2.7.1 on winXPp, py2exe-0.6.9 and mpmath 0.17 in this
case.
The relevant part of my script source only contains "import mpmath" to make
it available in the exe-d app.
Now, it seems, that py2exe somehow tries to compile also the inappropriate
exec_py3.py resulting in:
"""
error: compiling 'C:\Python27\lib\site-packages\mpmath\libmp\exec_py3.py'
failed

SyntaxError: invalid syntax (exec_py3.py, line 1)
"""

Renaming the extension of the respective file to e.g. exec_py3.pyQQQ
seems to circumvent the problem with py2exe, the exe-compilation runs ok
and the app seems to be working.

Unfortunately, I don't know enough about both libraries to know, whether
this can be handled in some more elegant way, be it in py2exe or mpmath.

regards,
Vlastimil Brom

mpm...@googlecode.com

unread,
Feb 5, 2011, 2:53:55 PM2/5/11
to mpmath...@googlegroups.com

Comment #1 on issue 204 by fredrik....@gmail.com: py2exe compile error for

Does py2exe not have an option to ignore a specific file?

Removing (or renaming) the file should be an ok solution, if it's not too
much trouble.

I couldn't think of a better way to support exec in both Python 2.x and
3.x, unfortunately. Anyone else have a good idea?

mpm...@googlecode.com

unread,
Feb 6, 2011, 8:21:16 PM2/6/11
to mpmath...@googlegroups.com

Comment #2 on issue 204 by Vlastimi...@gmail.com: py2exe compile error for

Thanks for the answer; if it isn't going to break anything on python 2.7, I
am quite happy with renaming the mentioned file.
I actually only use basic features of py2exe and I may be missing some
relevant parameters; the only one I know of in thic context - excludes -
doesn't seem to apply here, it probably doesn't involve compiling but only
the not-including to the executables folder.
regards,
Vlastimil Brom


mpm...@googlecode.com

unread,
Jul 23, 2011, 9:45:13 AM7/23/11
to mpmath...@googlegroups.com

Comment #3 on issue 204 by vlada.pe...@gmail.com: py2exe compile error for

Re: exec: you can try handling it with:

if PY3:
exec_ = eval("exec")

That shouldn't report any errors. Solution from six:
https://bitbucket.org/gutworth/six/src/b44b9955e9a5/six.py

mpm...@googlecode.com

unread,
Jul 23, 2011, 2:43:46 PM7/23/11
to mpmath...@googlegroups.com

Comment #4 on issue 204 by fredrik....@gmail.com: py2exe compile error for

Yes, that's probably the right way to do it. The "if PY3" case is actually
simple; it's the other one that's hard, but six.py seems to have a working
solution.

mpm...@googlecode.com

unread,
Jul 23, 2011, 7:28:06 PM7/23/11
to mpmath...@googlegroups.com

Comment #5 on issue 204 by asmeurer: py2exe compile error for exec_py3.py -

Can you make a note at http://code.google.com/p/sympy/issues/detail?id=2598
for any fixes you make to syntax errors in Python 2, so I can fix them in
SymPy before the release (apparently pip complains about them)?

mpm...@googlecode.com

unread,
Feb 4, 2013, 11:23:35 PM2/4/13
to mpmath...@googlegroups.com

Comment #6 on issue 204 by lemyska...@gmail.com: py2exe compile error for
lo que dice #3 vlada.pe...@gmail.com funciona correctamente

mpm...@googlecode.com

unread,
Oct 8, 2013, 8:47:58 PM10/8/13
to mpmath...@googlegroups.com

Comment #7 on issue 204 by kushanav...@gmail.com: py2exe compile error for
When I try "if PY3: exec_ = eval("exec")" it gives me RuntimeError: maximum
recursion depth exceeded

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

mpm...@googlecode.com

unread,
Jan 8, 2014, 12:05:37 PM1/8/14
to mpmath...@googlegroups.com

Comment #8 on issue 204 by andresmi...@gmail.com: py2exe compile error for
I agree with kushanav...@gmail.com. When chnaging the file
to "exec_py3.pyQQQ" the error becomes "RuntimeError: maximum recursion
depth exceeded"
I was trying to use Pyinstaler to use it in Linux. Same error.
Please help!!

mpm...@googlecode.com

unread,
Jan 8, 2014, 12:43:20 PM1/8/14
to mpmath...@googlegroups.com

Comment #9 on issue 204 by fredrik....@gmail.com: py2exe compile error for
Does it work with mpmath 0.18?

mpm...@googlecode.com

unread,
Jan 28, 2014, 11:30:31 AM1/28/14
to mpmath...@googlegroups.com

Comment #10 on issue 204 by ducarazv...@gmail.com: py2exe compile error for
"When I try "if PY3: exec_ = eval("exec")" it gives me RuntimeError:
maximum recursion depth exceeded"

same problem here. any solution ?

mpm...@googlecode.com

unread,
Jan 29, 2014, 8:18:24 PM1/29/14
to mpmath...@googlegroups.com

Comment #11 on issue 204 by asme...@gmail.com: py2exe compile error for
SymPy uses

if PY3:
exec_ = getattr(builtins, "exec")
else:
def exec_(_code_, _globs_=None, _locs_=None):
"""Execute code in a namespace."""
if _globs_ is None:
frame = sys._getframe(1)
_globs_ = frame.f_globals
if _locs_ is None:
_locs_ = frame.f_locals
del frame
elif _locs_ is None:
_locs_ = _globs_
exec("exec _code_ in _globs_, _locs_")

which I think is taken from six.
Reply all
Reply to author
Forward
0 new messages