Question

I am trying to convert python code to a windows .exe using cx_freeze. When I run the setup.py using the command line it runs as usual and then just returns invalid syntax. The program uses the tkinter module as well as sympy and I believe it is the latter causing the problem. Any solutions will be much appreciated. Below is the last part of the process before it stops.

deferredImports, namespace = namespace)

  File "C:\Python33\lib\site-packages\cx_Freeze\finder.py", line 338, in _Intern
alImportModule
    parentModule, namespace)
  File "C:\Python33\lib\site-packages\cx_Freeze\finder.py", line 366, in _LoadMo
dule
    module.code = compile(codeString, path, "exec")
  File "C:\Python33\lib\site-packages\sympy\mpmath\libmp\exec_py2.py", line 2
    exec string in globals, locals
              ^
SyntaxError: invalid syntax
Was it helpful?

Solution

The compatibility for exec in SymPy (actually mpmath, which is included with SymPy) uses a file that is only run in Python 2 that is invalid syntax in Python 3 and a file that is only run in Python 3 that is invalid syntax in Python 2. You can safely ignore the one on the other. If cx_freeze refuses to skip this file, you can safely delete it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top