1

With my Application it should be possible to open Files with my Programm. But when I click on myfile..mft > Open with > myexe_to_open_mft.exe Then the exe gets an error: Fatal error, faild to execute script. If I open the program regular without open with, I get no errors and if I open it via command prompt I get also no errors. Thanks for the help!

(Edit: At the end I fixed this error by hided the console via ctypes)

pyinstaller --windowed -i icon.ico PickleViewer.py

Image from the Script if run over command line

Screenshot of the error

Output from pyinstaller

162 INFO: PyInstaller: 3.5
162 INFO: Python: 3.7.4
163 INFO: Platform: Windows-10-10.0.18362-SP0
173 INFO: wrote 
C:\Users\user\Documents\Python\Documents\pickle_viewer\PickleViewer.spec
177 INFO: UPX is not available.
179 INFO: Extending PYTHONPATH with paths
['C:\\Users\\user\\Documents\\Python\\Documents\\pickle_viewer',
'C:\\Users\\user\\Documents\\Python\\Documents\\pickle_viewer']
180 INFO: checking Analysis
199 INFO: Building because 
C:\Users\user\Documents\Python\Documents\pickle_viewer\PickleViewer.py 
changed
200 INFO: Initializing module dependency graph...
206 INFO: Initializing module graph hooks...
211 INFO: Analyzing base_library.zip ...
5148 INFO: running Analysis Analysis-00.toc
5191 INFO: Adding Microsoft.Windows.Common-Controls to dependent 
assemblies of final executable
required by c:\users\user\appdata\local\programs\python\python37- 
32\python.exe
8448 INFO: Caching module hooks...
8463 INFO: Analyzing 
C:\Users\user\Documents\Python\Documents\pickle_viewer\PickleViewer.py
8789 INFO: Loading module hooks...
8789 INFO: Loading module hook "hook-encodings.py"...
8936 INFO: Loading module hook "hook-pydoc.py"...
8938 INFO: Loading module hook "hook-xml.py"...
9298 INFO: Loading module hook "hook-_tkinter.py"...
9871 INFO: checking Tree
9931 INFO: checking Tree
9984 INFO: Looking for ctypes DLLs
9985 INFO: Analyzing run-time hooks ...
9989 INFO: Including run-time hook 'pyi_rth__tkinter.py'
9996 INFO: Looking for dynamic libraries
17315 INFO: Looking for eggs
17316 INFO: Using Python library 
c:\users\user\appdata\local\programs\python\python37-32\python37.dll
17316 INFO: Found binding redirects:
[]
17331 INFO: Warnings written to 
C:\Users\user\Documents\Python\Documents\pickle_viewer\build\PickleViewer\
warn 
-PickleViewer.txt
17397 INFO: Graph cross-reference written to 
C:\Users\user\Documents\Python\Documents\pickle_viewer\build\PickleViewer\xre 
f-PickleViewer.html
17499 INFO: checking PYZ
17501 INFO: Building because toc changed
17502 INFO: Building PYZ (ZlibArchive) 
C:\Users\user\Documents\Python\Documents\pickle_viewer\build\PickleViewer\PYZ 
-00.pyz
18467 INFO: Building PYZ (ZlibArchive) 
C:\Users\user\Documents\Python\Documents\pickle_viewer\build\PickleViewer\
PYZ- 
00.pyz completed successfully.
18499 INFO: checking PKG
18501 INFO: Building because 
C:\Users\user\Documents\Python\Documents\pickle_viewer\build\PickleViewer\PYZ 
-00.pyz changed
18502 INFO: Building PKG (CArchive) PKG-00.pkg
18549 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
18554 INFO: Bootloader c:\users\user\appdata\local\programs\python\python37- 
32\lib\site- 
packages\PyInstaller\bootloader\Windows-32bit\runw.exe
18554 INFO: checking EXE
18556 INFO: Building because console changed
18556 INFO: Building EXE from EXE-00.toc
18651 INFO: Copying icons from ['icon.ico']
18754 INFO: Writing RT_GROUP_ICON 0 resource with 20 bytes
18755 INFO: Writing RT_ICON 1 resource with 22767 bytes
19067 INFO: Appending archive to EXE 
C:\Users\user\Documents\Python\Documents\pickle_viewer\build\PickleViewer\
Pick 
leViewer.exe
19249 INFO: Building EXE from EXE-00.toc completed successfully.
19266 INFO: checking COLLECT
WARNING: The output directory 
"C:\Users\user\Documents\Python\Documents\pickle_viewer\dist\PickleViewer" 
and ALL ITS CONTENTS will be REMOVED! Continue? (y/N)y
21243 INFO: Removing dir 
C:\Users\user\Documents\Python\Documents\pickle_viewer\dist\PickleViewer
21736 INFO: Building COLLECT COLLECT-00.toc
33512 INFO: Building COLLECT COLLECT-00.toc completed successfully.

2 Answers 2

1

I know this error, "Fatal error, failed to execute script"

This error because you compile a python script (.pyw not .py) to .exe format, BUT there's no GUI available in that script. So you must use the 'py' extension (in Pyinstaller, do not type '-W') or use PyGame, PyQT etc.

And Tkinter is not compatible with .pyw extension, so you should use PyGame or PyQt or other big library for GUI

Sign up to request clarification or add additional context in comments.

11 Comments

So I'm using Tinker and a .py extension, if I understood you correctly these are the cretins. And I have no error if I start the script via command line... Whats wrong?
can you please screenshot so i can know what is your problem?
I can send te command for the build and a screenshot of the error, and a screenshot when i start if over command line
do not use --windowed, because it will make an error
or if you want to hide a console you can use ctypes
|
0

I think i found it:

if getattr(sys, 'frozen', False): # we are running in a bundle frozen = 'ever so' bundle_dir = sys._MEIPASS else: # we are running in a normal Python environment bundle_dir = os.path.dirname(os.path.abspath(__file__))

Edit: didnt helped

EDIT (SOLUTION):

I made it by hiding the console via ctypes.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.