marcelotduarte / cx_Freeze

cx_Freeze creates standalone executables from Python scripts, with the same performance, is cross-platform and should work on any platform that Python itself works on.
https://marcelotduarte.github.io/cx_Freeze/
Other
1.33k stars 217 forks source link

Update finder.py to fix RecursionError: maximum recursion depth exceeded #2272

Open WoolenWang opened 7 months ago

WoolenWang commented 7 months ago

if module is to much , RecursionError: maximum recursion depth exceeded , fix to scan_code new one thread

File "E:\git\python-3.11.6\Lib\site-packages\cx_Freeze\finder.py", line 348, in _internal_import_module module = self._load_module( File "E:\git\python-3.11.6\Lib\site-packages\cx_Freeze\finder.py", line 415, in _load_module self._load_module_code(module, loader, deferred_imports) │ │ │ └ [(<Module name='scipy.interpolate.fitpack', file=WindowsPath('E:/git/python-3.11.6/Lib/site-packages/scipy/interpolate/fitpack.p... │ │ └ <_frozen_importlib_external.SourceFileLoader object at 0x000001DBA2FF5410> │ └ <Module name='sympy.printing.pretty', file=WindowsPath('E:/git/python-3.11.6/Lib/site-packages/sympy/printing/pretty/__init__.py... └ <cx_Freeze.finder.ModuleFinder object at 0x000001DB8B286ED0> File "E:\git\python-3.11.6\Lib\site-packages\cx_Freeze\finder.py", line 465, in _load_module_code self._scan_code(module.code, module, deferred_imports) │ │ │ └ [(<Module name='scipy.interpolate.fitpack', file=WindowsPath('E:/git/python-3.11.6/Lib/site-packages/scipy/interpolate/fitpack.p... │ │ └ <Module name='sympy.printing.pretty', file=WindowsPath('E:/git/python-3.11.6/Lib/site-packages/sympy/printing/pretty/__init__.py... │ └ <Module name='sympy.printing.pretty', file=WindowsPath('E:/git/python-3.11.6/Lib/site-packages/sympy/printing/pretty/__init__.py... └ <cx_Freeze.finder.ModuleFinder object at 0x000001DB8B286ED0> File "E:\git\python-3.11.6\Lib\site-packages\cx_Freeze\finder.py", line 626, in _scan_code imported_module = self._import_module( File "E:\git\python-3.11.6\Lib\site-packages\cx_Freeze\finder.py", line 294, in _import_module module = self._internal_import_module(name, deferred_imports) │ │ └ [(<Module name='scipy.interpolate.fitpack', file=WindowsPath('E:/git/python-3.11.6/Lib/site-packages/scipy/interpolate/fitpack.p... │ └ 'sympy.printing.pretty.pretty' └ <cx_Freeze.finder.ModuleFinder object at 0x000001DB8B286ED0> File "E:\git\python-3.11.6\Lib\site-packages\cx_Freeze\finder.py", line 348, in _internal_import_module module = self._load_module( File "E:\git\python-3.11.6\Lib\site-packages\cx_Freeze\finder.py", line 415, in _load_module self._load_module_code(module, loader, deferred_imports) │ │ │ └ [(<Module name='scipy.interpolate.fitpack', file=WindowsPath('E:/git/python-3.11.6/Lib/site-packages/scipy/interpolate/fitpack.p... │ │ └ <_frozen_importlib_external.SourceFileLoader object at 0x000001DBA2FF6AD0> │ └ <Module name='sympy.printing.pretty.pretty', file=WindowsPath('E:/git/python-3.11.6/Lib/site-packages/sympy/printing/pretty/pret... └ <cx_Freeze.finder.ModuleFinder object at 0x000001DB8B286ED0> File "E:\git\python-3.11.6\Lib\site-packages\cx_Freeze\finder.py", line 465, in _load_module_code self._scan_code(module.code, module, deferred_imports) │ │ │ └ [(<Module name='scipy.interpolate.fitpack', file=WindowsPath('E:/git/python-3.11.6/Lib/site-packages/scipy/interpolate/fitpack.p... │ │ └ <Module name='sympy.printing.pretty.pretty', file=WindowsPath('E:/git/python-3.11.6/Lib/site-packages/sympy/printing/pretty/pret... │ └ <Module name='sympy.printing.pretty.pretty', file=WindowsPath('E:/git/python-3.11.6/Lib/site-packages/sympy/printing/pretty/pret... └ <cx_Freeze.finder.ModuleFinder object at 0x000001DB8B286ED0> File "E:\git\python-3.11.6\Lib\site-packages\cx_Freeze\finder.py", line 626, in _scan_code imported_module = self._import_module( File "E:\git\python-3.11.6\Lib\site-packages\cx_Freeze\finder.py", line 260, in _import_module module = self._internal_import_module(name, deferred_imports) │ │ └ [(<Mod

codecov[bot] commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 83.13%. Comparing base (e6b15a7) to head (73c441f).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #2272 +/- ## ========================================== + Coverage 83.10% 83.13% +0.02% ========================================== Files 27 27 Lines 4026 4031 +5 ========================================== + Hits 3346 3351 +5 Misses 680 680 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

brummel-promed commented 2 months ago

I just got this recursion error with cx_Freeze 7.1.1. I was able to work around it by changing my build_exe_options to exclude a number of things, including scipy.