I have this problem where if I try to run py2exe on my python file that uses Pyqt/Pyside I get the following error when trying to run the EXE generated in I:\Documents\Python\Buttonio_Testio\dist :
I:\Documents\Python\Buttonio_Testio\dist>Package.exe
Traceback (most recent call last):
File "Package.py", line 1, in <module>
File "PySide\__init__.pyc", line 55, in <module>
File "PySide\__init__.pyc", line 11, in _setupQtDirectories
File "PySide\_utils.pyc", line 87, in get_pyside_dir
File "PySide\_utils.pyc", line 83, in _get_win32_case_sensitive_name
File "PySide\_utils.pyc", line 58, in _get_win32_short_name
WindowsError: [Error 3] The system cannot find the path specified.
from distutils.core import setup
import py2exe
setup(console=['Package.py'])
My program, in Package.py looks like this:
from PySide.QtCore import *
from PySide.QtGui import *
import sys
import Gui
class Ui_Dialog(QDialog, Gui.Ui_Dialog):
#Setupui and function afterwards generated converting XML file made by QT Desiner to python.
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(279, 295)
self.textBrowser = QtGui.QTextBrowser(Dialog)
self.textBrowser.setGeometry(QtCore.QRect(10, 10, 256, 192))
self.textBrowser.setObjectName("textBrowser")
self.pushButton = QtGui.QPushButton(Dialog)
self.pushButton.setGeometry(QtCore.QRect(10, 210, 251, 71))
self.pushButton.setObjectName("PushButton")
self.retranslateUi(Dialog)
QtCore.QObject.connect(self.pushButton, QtCore.SIGNAL("clicked()"), self.textBrowser.clear)
QtCore.QMetaObject.connectSlotsByName(Dialog)
def retranslateUi(self, Dialog):
Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "Dialog", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton.setText(QtGui.QApplication.translate("Dialog", "Clear Spam", None, QtGui.QApplication.UnicodeUTF8))
def __init__(self, parent=None):
super(Ui_Dialog, self).__init__(parent)
self.setupUi(self)
self.spam()
def spam(self):
self.textBrowser.append("SPAM")
self.textBrowser.append("SPAM")
self.textBrowser.append("SPAM")
self.textBrowser.append("LOL")
self.textBrowser.append("I")
self.textBrowser.append("AM")
self.textBrowser.append("SPAMMING")
self.textBrowser.append("MYSELF")
app = QApplication(sys.argv)
form = Ui_Dialog()
form.show()
app.exec_()
I am running windows 8 with 32bit python and 32bit modules installed. The setup.py file was in the same folder as Package.py when I ran setup.py in Command Prompt. Besides that I don't know what other information may help fix my problem.
That's all, thank you for any answers in advance.
The problem was that _utils.py used __file__
, but __file__
is not available in frozen executables. This has been fixed in PySide 1.2.1 that was released a few days ago (it was fixed by commit 817a5c9bd39d3a22e2a7db9aa497059be57d58d7).
I was desperately looking for a solution to this for the past three hours. I ended up going into the _ _ init_ _.py file in C:\Python27\Lib\site-packages\PySide directory. I changed the last line to the following:
try:
_setupQtDirectories()
except WindowsError:
pass
It is ugly I admit. I hope PySide people will fix this soon.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With