1

So I'm generating exe with PyInstaller, using UPX as to make the size of the executable file smaller. However, the executable file generated with UPX shows errors like this:

PS [path]\dist> .\api
Traceback (most recent call last):
  File "api.py", line 4, in <module>
  File "e:\python\python375-32\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\pandas\__init__.py", line 55, in <module>
  File "e:\python\python375-32\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\pandas\core\api.py", line 24, in <module>
  File "e:\python\python375-32\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\pandas\core\groupby\__init__.py", line 1, in <module>
  File "e:\python\python375-32\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\pandas\core\groupby\generic.py", line 44, in <module>
  File "e:\python\python375-32\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\pandas\core\frame.py", line 115, in <module>
  File "e:\python\python375-32\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\pandas\core\series.py", line 4892, in <module>
  File "site-packages\pandas\core\generic.py", line 10747, in _add_series_or_dataframe_operations
  File "e:\python\python375-32\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\pandas\core\window.py", line 13, in <module>
ImportError: DLL load failed: 参数错误。[Note: "Incorrect arguments" in Chinese]
[133820] Failed to execute script api

However, if I use --noupx, the generated exe functions completely well. I believe that UPX corrupts some DLL files required by libraries like pandas, but I'd still like to compress as many DLL files as possible. How should I find out which DLL files are corrupted so that I can include them in --upx-exclude list?

SnzFor16Min
  • 113
  • 6
  • 1
    Try using something like [depends](http://www.dependencywalker.com/) to find out which DLLs it tries to load but can't. – SitiSchu Nov 25 '19 at 15:08
  • @SitiSchu Thanks! I hadn't expected there would be tools for this! However it seems too old that it *freezes* the moment I import the executable file, about 63 MB :-O – SnzFor16Min Nov 25 '19 at 16:08
  • Just give it a bit of time, it checks if the DLLs exist so depending on the size of your %PATH% it might take a while. I've used it on multiple larger applications with lots of dependencies. – SitiSchu Nov 25 '19 at 16:14

0 Answers0