Aug-09-2018, 02:16 PM
(This post was last modified: Aug-09-2018, 02:16 PM by johnlawlor.)
We use py2exe to generate an executable for one of our tools. This worked perfectly for x number of years on Python 3.4 until i added a feature that required a JIRA module.
Now when i try to generate an exe from the code:
pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org --trusted-host pypi.python.org JIRAThen in the code:
from jira.client import JIRA
Now when i try to generate an exe from the code:
from distutils.core import setup import py2exe import sys sys.setrecursionlimit(10000) setup( windows=[{ "script":"myscript.py", "icon_resources": [(1, "icon.ico")], "dest_base":"myscript" }], options={"py2exe":{"includes":["sip","sys","decimal"],"bundle_files": 1}})It fails with:
Error:running py2exe
Traceback (most recent call last):
File "mysetup.py", line 13, in <module>
options={"py2exe":{"includes":["sip","sys","decimal"],"bundle_files": 1}})
File "C:\Python34\lib\distutils\core.py", line 149, in setup dist.run_commands()
File "C:\Python34\lib\distutils\dist.py", line 955, in run_commands self.run_command(cmd)
File "C:\Python34\lib\distutils\dist.py", line 974, in run_command cmd_obj.run()
File "C:\Python34\lib\site-packages\py2exe\distutils_buildexe.py", line 188, in run self._run()
File "C:\Python34\lib\site-packages\py2exe\distutils_buildexe.py", line 267, in _rubuilder.analyze()
File "C:\Python34\lib\site-packages\py2exe\runtime.py", line 173, in analyze target.analyze(mf)
File "C:\Python34\lib\site-packages\py2exe\runtime.py", line 74, in analyze modulefinder.run_script(self.script)
File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 86, in run_script self._scan_code(mod.__code__, mod)
File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 401, in _scan_code self._scan_code(c, mod)
File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 401, in _scan_code self._scan_code(c, mod)
File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 394, in _scan_code self.safe_import_hook(name, mod, fromlist, level)
File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 138, in safe_import_hook self.import_hook(name, caller, fromlist, level)
File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 120, in import_hook module = self._gcd_import(name)
File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 274, in _gcd_import return self._find_and_load(name)
File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 288, in _find_and_load self._gcd_import(parent)
File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 274, in _gcd_import return self._find_and_load(name)
File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 357, in _find_and_load self._scan_code(module.__code__, module)
File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 394, in _scan_code self.safe_import_hook(name, mod, fromlist, level)
File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 138, in safe_import_hook self.import_hook(name, caller, fromlist, level)
File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 120, in import_hook module = self._gcd_import(name)
File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 274, in _gcd_import return self._find_and_load(name)
File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 288, in _find_and_load self._gcd_import(parent)
File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 274, in _gcd_import return self._find_and_load(name)
File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 298, in _find_and_load getattr(parent_module, name.rpartition('.')[2])
File "C:\Python34\lib\site-packages\py2exe\hooks.py", line 291, in __getattr__ self.__finder.safe_import_hook(renamed, caller=self)self.import_hook(name, caller, fromlist, level)
File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 120, in import_hook module = self._gcd_import(name)
File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 274, in _gcd_import return self._find_and_load(name)
File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 298, in _find_and_load getattr(parent_module, name.rpartition('.')[2])
File "C:\Python34\lib\site-packages\py2exe\hooks.py", line 291, in __getattr__ self.__finder.safe_import_hook(renamed, caller=self)
File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 138, in safe_import_hook self.import_hook(name, caller, fromlist, level)
File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 120, in import_hook module = self._gcd_import(name)
File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 274, in _gcd_import return self._find_and_load(name)
File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 298, in _find_and_load getattr(parent_module, name.rpartition('.')[2])
File "C:\Python34\lib\site-packages\py2exe\hooks.py", line 291, in __getattr__ self.__finder.safe_import_hook(renamed, caller=self)
File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 135, in safe_import_hook self._info(name, caller, fromlist, level)
RuntimeError: maximum recursion depth exceeded
When i uninstall the JIRA module the error goes away. We'd still like to use Py2exe.