Python Forum

Full Version: Help with PyInstaller + Script "Failed to Execute Script"
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,

I've made some progress. Its been slow but its coming along.

The script i made converts first page of PDF to JPEG with Poppler + PDF2image module (installed via pip). Coding in PyCharm. Script runs great. No errors.

I am trying to compile to .EXE via PyInstaller in Windows 10. I use the following CMD:

>>>>C:\python37\Projects\PyThumbnail4>pyinstaller --onefile -w MainScript.py 
OUTPUT:

56 INFO: PyInstaller: 3.5
56 INFO: Python: 3.7.4
56 INFO: Platform: Windows-10-10.0.17763-SP0
57 INFO: wrote C:\python37\Projects\PyThumbnail4\MainScript.spec
58 INFO: UPX is not available.
59 INFO: Extending PYTHONPATH with paths
['C:\\python37\\Projects\\PyThumbnail4', 'C:\\python37\\Projects\\PyThumbnail4']
59 INFO: checking Analysis
61 INFO: Building because C:\python37\Projects\PyThumbnail4\MainScript.py changed
61 INFO: Initializing module dependency graph...
62 INFO: Initializing module graph hooks...
64 INFO: Analyzing base_library.zip ...
2132 INFO: running Analysis Analysis-00.toc
2136 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by c:\python37\python.exe\python.exe
2575 INFO: Caching module hooks...
2578 INFO: Analyzing C:\python37\Projects\PyThumbnail4\MainScript.py
2917 INFO: Processing pre-find module path hook   distutils
2996 INFO: Loading module hooks...
2996 INFO: Loading module hook "hook-distutils.py"...
2997 INFO: Loading module hook "hook-encodings.py"...
3058 INFO: Loading module hook "hook-PIL.Image.py"...
3379 INFO: Loading module hook "hook-PIL.py"...
3380 INFO: Excluding import 'PyQt4'
3381 INFO:   Removing import of PyQt4 from module PIL.ImageQt
3381 INFO: Excluding import 'PyQt5'
3382 INFO:   Removing import of PyQt5 from module PIL.ImageQt
3383 INFO: Excluding import 'PySide'
3384 INFO:   Removing import of PySide from module PIL.ImageQt
3384 INFO: Import to be excluded not found: 'FixTk'
3384 INFO: Excluding import 'tkinter'
3385 INFO:   Removing import of tkinter from module PIL.ImageTk
3386 INFO: Loading module hook "hook-PIL.SpiderImagePlugin.py"...
3387 INFO: Import to be excluded not found: 'FixTk'
3387 INFO: Excluding import 'tkinter'
3388 INFO: Loading module hook "hook-pydoc.py"...
3389 INFO: Loading module hook "hook-xml.py"...
3531 INFO: Loading module hook "hook-_tkinter.py"...
3679 INFO: checking Tree
3719 INFO: checking Tree
3737 INFO: Looking for ctypes DLLs
3743 INFO: Analyzing run-time hooks ...
3750 INFO: Looking for dynamic libraries
5103 INFO: Looking for eggs
5103 INFO: Using Python library c:\python37\python.exe\python37.dll
5104 INFO: Found binding redirects:
[]
5113 INFO: Warnings written to C:\python37\Projects\PyThumbnail4\build\MainScript\warn-MainScript.txt
5146 INFO: Graph cross-reference written to C:\python37\Projects\PyThumbnail4\build\MainScript\xref-MainScript.html
5168 INFO: checking PYZ
5169 INFO: Building because toc changed
5169 INFO: Building PYZ (ZlibArchive) C:\python37\Projects\PyThumbnail4\build\MainScript\PYZ-00.pyz
5526 INFO: Building PYZ (ZlibArchive) C:\python37\Projects\PyThumbnail4\build\MainScript\PYZ-00.pyz completed successfully.
5538 INFO: checking PKG
5539 INFO: Building because toc changed
5539 INFO: Building PKG (CArchive) PKG-00.pkg
6866 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
6872 INFO: Bootloader c:\python37\python.exe\lib\site-packages\PyInstaller\bootloader\Windows-64bit\runw.exe
6872 INFO: checking EXE
6875 INFO: Building because toc changed
6875 INFO: Building EXE from EXE-00.toc
6875 INFO: Appending archive to EXE C:\python37\Projects\PyThumbnail4\dist\MainScript.exe
6973 INFO: Building EXE from EXE-00.toc completed successfully.
All goes well, but when I run .EXE from CMD line I get "Failed to Execute Script". Unsure why? Is poppler/PDF2Image not being packaged into my .EXE??


Thank you for your help!
UPDATE:

Issue appears to be when using --noconsole or -w or -windowed with Pyinstaller.

If i do not try and prevent console from running and pkg my file, it runs fine.

Ideas?????

Thanks
Anyone?