Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyQt4 script frozen by PyInstaller gives Fatal Error:"Failed to execute script xyz"

I am writing the following Python 3.5 script:

import sys
from PyQt4 import QtGui


class Window(QtGui.QMainWindow):

    def __init__(self):
        super().__init__()
        self.setGeometry(50, 50, 500, 300)
        self.setWindowTitle("HelloGUI")
        self.show()


def run():
    app = QtGui.QApplication(sys.argv)
    win = Window()
    sys.exit(app.exec_())

run()

I create executable using PyInstaller. It runs normally. Though when I try to run the executable on a different PC (which has no Python installed) than mine, it gives the following Fatal Error Message: "Failed to execute script [script-name]".

If someone has an idea how I can make my GUI programms portable, please leave a comment. Otherwise, if what I have in my mind cannot be done, please let me know.


Windows10 (64 bit), Python 3.5(32 bit), PyInstaller(3.2), PyQt4

like image 844
iagerogiannis Avatar asked May 14 '16 13:05

iagerogiannis


1 Answers

I solved my issue using --noupx when I use pyinstaller. [PyQt5-Python 3.4]

Example;

pyinstaller.exe --onefile --windowed --noupx --icon=app.ico myapp.py

Check this if the codes above doesn't solve your problem.

like image 124
GLHF Avatar answered Oct 23 '22 05:10

GLHF