Python Forum
Help with PyInstaller + Script "Failed to Execute Script"
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with PyInstaller + Script "Failed to Execute Script"
#1
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!
Reply
#2
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
Reply
#3
Anyone?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to include one script into another? MorningWave 8 304 Mar-21-2024, 10:34 PM
Last Post: MorningWave
  ChromeDriver breaking Python script genericusername12414 1 214 Mar-14-2024, 09:39 AM
Last Post: snippsat
  using PowerShell from Python script for mounting shares tester_V 8 399 Mar-12-2024, 06:26 PM
Last Post: tester_V
  No Internet connection when running a Python script basil_555 8 442 Mar-11-2024, 11:02 AM
Last Post: snippsat
Question Running Python script through Task Scheduler? Winfried 8 335 Mar-10-2024, 07:24 PM
Last Post: Winfried
  Combine console script + GUI (tkinter) dejot 2 360 Feb-27-2024, 04:38 PM
Last Post: deanhystad
  How to receive two passed cmdline parameters and access them inside a Python script? pstein 2 277 Feb-17-2024, 12:29 PM
Last Post: deanhystad
  OBS Script Troubleshooting Jotatochips 0 252 Feb-10-2024, 06:18 PM
Last Post: Jotatochips
  Triggering a ps1 script in remote windows server via http python request jasveerjassi 1 316 Jan-26-2024, 07:02 PM
Last Post: deanhystad
  Make entire script run again every 45 mo NDillard 0 292 Jan-23-2024, 09:40 PM
Last Post: NDillard

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020