[PyQt] Bug in QFileDialog
Hi, the attached script shows a bug in QFileDialog. If on a given dialog you call setLabelText(QFileDialog.Accept, text) and then you call setFileMode(FileMode) then the label is not set and the default label is used. If you call setFileMode(FileMode) first and then you call setLabelText(QFileDialog.Accept, text) then the label is set. As you can see in the script the problem only happens with the QFileDialog.Accept constant. Other QFileDialog.DialogLabel constants work fine. I don't know if it is a Qt bug or a PyQt one. Neither I know if the problem is in the setLabelText method or in th setFileMode one. Vicent :: Share what you know, learn what you don't #!/usr/bin/env python import sys from PyQt4 import QtGui from PyQt4 import QtCore def doItRight(): file_selector = QtGui.QFileDialog(None, 'File selector') file_selector.setFileMode(QtGui.QFileDialog.AnyFile) file_selector.setLabelText(QtGui.QFileDialog.Accept, 'accept label') file_selector.setLabelText(QtGui.QFileDialog.Reject, 'reject label') file_selector.setLabelText(QtGui.QFileDialog.LookIn, 'look in label') file_selector.setLabelText(QtGui.QFileDialog.FileName, 'filename label') file_selector.setLabelText(QtGui.QFileDialog.FileType, 'filetype label') file_selector.exec_() del file_selector def doItWrong(): file_selector = QtGui.QFileDialog(None, 'File selector') file_selector.setLabelText(QtGui.QFileDialog.Accept, 'accept label') file_selector.setLabelText(QtGui.QFileDialog.Reject, 'reject label') file_selector.setLabelText(QtGui.QFileDialog.LookIn, 'look in label') file_selector.setLabelText(QtGui.QFileDialog.FileName, 'filename label') file_selector.setLabelText(QtGui.QFileDialog.FileType, 'filetype label') file_selector.setFileMode(QtGui.QFileDialog.AnyFile) file_selector.exec_() del file_selector def main(): app = QtGui.QApplication(sys.argv) doItRight() doItWrong() app.exec_() if __name__ == '__main__': main() signature.asc Description: This is a digitally signed message part. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Python 3 import error
I just wanted to say that the amount of knowledgeable, fast help I received here yesterday was incredible. In this thread I experienced about six or so different problems porting a script to Python 3 and each one of that was immediately solved showing immense knowledge not just about PyQt itself but also about other Python related technologies. Thanks, guys. Thorsten ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Bug in QFileDialog
On 2010-12-03 Vicent Mas uve...@gmail.com said: Hi, the attached script shows a bug in QFileDialog. If on a given dialog you call setLabelText(QFileDialog.Accept, text) and then you call setFileMode(FileMode) then the label is not set and the default label is used. If you call setFileMode(FileMode) first and then you call setLabelText(QFileDialog.Accept, text) then the label is set. As you can see in the script the problem only happens with the QFileDialog.Accept constant. Other QFileDialog.DialogLabel constants work fine. I don't know if it is a Qt bug or a PyQt one. Neither I know if the problem is in the setLabelText method or in th setFileMode one. I forgot to mention the versions info: Python 2.5.5 Qt 4.6.3 PyQt 4.8 Vicent :: Share what you know, learn what you don't signature.asc Description: This is a digitally signed message part. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Translations failing when not using self for the instance
Hi, when using other names for the self idiom referring to the current instance (like inst for example - see [1]), the application is not correctly translated. If I open the generated ts file in Qt Linguist it shows two contexts (MainWindow and inst) instead of just one (MainWindow) when using self. The translation for the text in the script (inst.tr('Ready') for example) shows still English - while the ones from the resource file work. Is that a problem with pyuic or with pylupdate4? Thorsten [1] from PyQt4 import QtGui, QtCore import resource.ui class MainWindow(QtGui.QMainWindow, resource.ui.Ui_MainWindow): def __init__(inst): QtGui.QMainWindow.__init__(inst) inst.setupUi(inst) inst.statusBar().showMessage(inst.tr('Ready')) ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Application not hiding from taskbar
Hi, I'm trying to implement minimize-to-tray but my application refuses to hide from taskbar. I've distilled the problematic code down to this little snippet, attached .ui-file. import sys, os from PyQt4 import uic from PyQt4.QtGui import QMainWindow, QApplication class MyClass(QMainWindow): def __init__(self, parent = None): QMainWindow.__init__(self, parent) self.ui = uic.loadUi(os.path.join(gui, timeTrackerClientGUI.ui), self) def hideEvent(self, event): self.hide() if __name__ == '__main__': app = QApplication(sys.argv) wnd = MyClass() wnd.show() app.exec_() According to http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qwidget.html#hideEvent I get a hideEvent when the user minimizes the window and that part works, but self.hide() doesn't hide my window from the taskbar. It's working fine in Linux, but in Windows 7 it refuses to hide. It looks like one icon hides but then another one pops up beside it, if I click quick enough you get this flickering effect I managed to catch in a screenshot, http://dl.dropbox.com/u/3184097/problem2.png I'm stumped, thought this would be simple to do. Kind regards Mikael Modin timeTrackerClientGUI.ui Description: Binary data ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Translations failing when not using self for the instance
On Friday 03 December 2010, 12:36:44 Thorsten Kampe wrote: Hi, when using other names for the self idiom referring to the current instance (like inst for example - see [1]), the application is not correctly translated. If I open the generated ts file in Qt Linguist it shows two contexts (MainWindow and inst) instead of just one (MainWindow) when using self. The translation for the text in the script (inst.tr('Ready') for example) shows still English - while the ones from the resource file work. Is that a problem with pyuic or with pylupdate4? Thorsten [1] from PyQt4 import QtGui, QtCore import resource.ui class MainWindow(QtGui.QMainWindow, resource.ui.Ui_MainWindow): def __init__(inst): QtGui.QMainWindow.__init__(inst) inst.setupUi(inst) inst.statusBar().showMessage(inst.tr('Ready')) In short: don't. This issue is most probably due to parsing deficits in pylupdate4 (which is still C++ inherited from lupdate). Don't defy it too much.. Your best bet is to adhere to the pyuic4 standard (e.g. check resource/ui.py). In order to reduce your typing needs, it's common to add a tr method to your classes, that may look like this: def tr(self, msg): return QtGui.QApplication.translate(YourClass, msg, None, QtGui.QApplication.UnicodeUTF8) That way, you have full control, and you can be sure, that translations work in almost all contexts, which might not always be the case otherwise (e.g. to trust on QWidget's tr implementation (please correct me if I'm wrong, Phil)). Again pyqt4ref.html has a paragraph about this very topic. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QVariant API 2 and QtGui.QGraphicsProxyWidget.itemChange()
On Wed, 1 Dec 2010 08:37:05 -0600, Aron Bierbaum aronbierb...@gmail.com wrote: I believe that we have found a bug with the conversion of QVariant objects in the QGraphicsProxyWidget.itemChange() method when using the API 2 version. The issue seems to be related to the fact that when we try to call setParent() on a graphics item that has overriden the itemChange() method, the change is not accepted. It appears that even if we directly return the value from QtGui.QGraphicsProxyWidget.itemChange(), the value is somehow getting reset to an empty QVariant. Any ideas on what could be going wrong. I have attached a simple example that shows the behavior. We are using Qt 4.7.1 PyQt 4.8.1 on Windows 7. It's actually a general problem, not specific to the QVariant API. Fixed in tonight's snapshot. Thanks, Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] QSqlTableModel.rowCount bug? (and still need infor for beforeInsert)
Hi all! I suspect QSqlTableModel.rowCount cannot return numbers above 256. For this finding could somebody please write me a mini-example of the QSqlTableModel.beforeInsert? Look, this outputs 256 for me (python 3.1.2, pyqt 4.8.1, XP SP3) And can somebody tell me why this code is this painfully slooow? import sys from PyQt4.QtCore import * from PyQt4.QtSql import * from PyQt4.QtGui import * app = QApplication(sys.argv) db = QSqlDatabase.addDatabase(QSQLITE) db.setDatabaseName('test.db') db.open() query = QSqlQuery('CREATE TABLE preferences (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, value varchar)') model = QSqlTableModel(db=db) model.setTable('preferences') model.select() for i in range(300): record = model.record() record.setValue('value', str(i)) res = model.insertRecord(-1, record) model.submitAll() print(model.rowCount()) del model, db thanks Gergo +-[ Gergely Kontra pihent...@gmail.com ]--+ | | | Mobile:(+36 20)356 9656 | | | +- Olyan lángész vagyok, hogy poroltóval kellene járnom! -+ ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] QSqlTableModel.beforeInsert signal (new style signal/slot)
Hi! I am trying to connect the beforeInsert signal of a QSqlTableModel, and having some problems. I've found this similar thread: http://www.mail-archive.com/pyqt@riverbankcomputing.com/msg20117.html However, I am using pyqt with py3k, so I prefer the new style signal and slots, but I appreciate any working solution... So my attempt based on the thread: class BatteryMain(base_class, form_class): # ... def cycle_started(self, record): print(Inserting {!r}.format(record)) def battery_load(self, filename): self.cycles_model = QSqlTableModel(db=self.battery_db) self.connect(self.cycles_model, SIGNAL(beforeInsert(QSqlRecord )), self.cycle_started) RESULT: QObject::connect: Cannot queue arguments of type 'QSqlRecord' (Make sure 'QSqlRecord' is registered using qRegisterMetaType().) Another attempt with new style signals and slots: class BatteryMain(base_class, form_class): # ... @pyqtSlot('QSqlRecord ') def cycle_started(self, record): print(Inserting {!r}.format(record)) def battery_load(self, filename): self.cycles_model = QSqlTableModel(db=self.battery_db) self.cycles_model.beforeInsert.connect(self.cycle_started) RESULT: File D:\prg\biQazo\biQazo.py, line 145, in battery_load self.cycles_model.beforeInsert.connect(self.cycle_started) TypeError: connect() failed between beforeInsert(QSqlRecord) and unislot() Could anybody tell me the correct syntax, please? thanks Gergo +-[ Gergely Kontra pihent...@gmail.com ]--+ | | | Mobile:(+36 20)356 9656 | | | +- Olyan lángész vagyok, hogy poroltóval kellene járnom! -+ ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] QSqlTableModel without view
[sorry for the posting more messages, but I figured out now, that my subscription address was wrong, and I got no error message from the list, that my messages will not appear :(] Hi! I am a novice pyqt developer. I will develop a pyqt program, which will periodically will get measurement data, and display it visually. That's why I have chosen to store it in sqlite database. Measurements have some metadata, so I thought they should also go to the same db, in an ini like table (table name preferences, key and value are strings). I have written 2 classes for that, but that does not seems like a straighforward solution... I hope there is a cleaner and more efficient way... class BatteryDb(QSqlDatabase): @classmethod def addSqlDb(cls, filename=None): db = QSqlDatabase.addDatabase(QSQLITE, 'battery') # if filename is None FIXME db.setDatabaseName(filename) db.open() return db @classmethod def removeSqlDb(cls, db): print(battery db delete) db.close() QSqlDatabase.removeDatabase('battery') class IniTable: def __init__(self, db, table, parent=None): self.model = QSqlTableModel(parent, db) self.model.setTable(table) self.model.setEditStrategy(QSqlTableModel.OnManualSubmit) self.db = db self.model.select() self.build_indices() def build_indices(self): self.indices = {} for i in range(self.model.rowCount()): self.indices[self.model.record(i).value('key')] = i def __getitem__(self, attr): return self.model.record(self.indices[attr]).value('value') def __setitem__(self, attr, value): if attr in self.indices: idx = self.indices[attr] record = self.model.record(idx) record.setValue('value', value) self.model.setRecord(idx, record) # idx = self.model.createIndex(self.indices[attr], self.model.fieldIndex('value')) #self.model.setData(idx, value) else: record = self.model.record() record.setValue('key', attr) record.setValue('value', value) res = self.model.insertRecord(-1, record) #self.build_indices() print('.') def submitAll(self): self.model.submitAll() +-[ Gergely Kontra pihent...@gmail.com ]--+ | | | Mobile:(+36 20)356 9656 | | | +- Olyan lángész vagyok, hogy poroltóval kellene járnom! -+ ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QSqlTableModel.rowCount bug? (and still need infor for beforeInsert)
On Freitag 03 Dezember 2010, KONTRA, Gergely wrote: Hi all! I suspect QSqlTableModel.rowCount cannot return numbers above 256. rowCount is not the number of rows in the table but in the model, AFAIK. Use fetchMore() to load more. And can somebody tell me why this code is this painfully slooow? you execute 300 transactions. If you use db.transaction() after db.open() and db.commit() after model.submitAll(), this is only one transaction and much faster. -- Wolfgang ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QSqlTableModel.beforeInsert signal (new style signal/slot)
On Fri, 3 Dec 2010 15:46:55 +0100, KONTRA, Gergely pihent...@gmail.com wrote: Hi! I am trying to connect the beforeInsert signal of a QSqlTableModel, and having some problems. I've found this similar thread: http://www.mail-archive.com/pyqt@riverbankcomputing.com/msg20117.html However, I am using pyqt with py3k, so I prefer the new style signal and slots, but I appreciate any working solution... So my attempt based on the thread: class BatteryMain(base_class, form_class): # ... def cycle_started(self, record): print(Inserting {!r}.format(record)) def battery_load(self, filename): self.cycles_model = QSqlTableModel(db=self.battery_db) self.connect(self.cycles_model, SIGNAL(beforeInsert(QSqlRecord )), self.cycle_started) RESULT: QObject::connect: Cannot queue arguments of type 'QSqlRecord' (Make sure 'QSqlRecord' is registered using qRegisterMetaType().) Another attempt with new style signals and slots: class BatteryMain(base_class, form_class): # ... @pyqtSlot('QSqlRecord ') def cycle_started(self, record): print(Inserting {!r}.format(record)) def battery_load(self, filename): self.cycles_model = QSqlTableModel(db=self.battery_db) self.cycles_model.beforeInsert.connect(self.cycle_started) RESULT: File D:\prg\biQazo\biQazo.py, line 145, in battery_load self.cycles_model.beforeInsert.connect(self.cycle_started) TypeError: connect() failed between beforeInsert(QSqlRecord) and unislot() Could anybody tell me the correct syntax, please? It's not a syntax problem. Are you using threads? I would guess that you can't use signals that take a QSqlRecord across threads, probably because they are not passed as const (to allow them to be updated by a connected slot). Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QSqlTableModel.rowCount bug? (and still need infor for beforeInsert)
On Fri, Dec 3, 2010 at 15:56, Wolfgang Rohdewald wolfg...@rohdewald.dewrote: On Freitag 03 Dezember 2010, KONTRA, Gergely wrote: Hi all! I suspect QSqlTableModel.rowCount cannot return numbers above 256. rowCount is not the number of rows in the table but in the model, AFAIK. Use fetchMore() to load more. Thats not logical. http://doc.trolltech.com/4.7/qsqltablemodel.html#rowCountdoesn't mention what is exactly rowCount, and one should expect the number of rows based on the name... fetchMore will then fetch all rows. I don't want that, just would like to know the number of rows, or just load the last record. And can somebody tell me why this code is this painfully slooow? you execute 300 transactions. If you use db.transaction() after db.open() and db.commit() after model.submitAll(), this is only one transaction and much faster. Sounds reasonable, thanks. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QSqlTableModel.beforeInsert signal (new style signal/slot)
On Fri, Dec 3, 2010 at 16:06, Phil Thompson p...@riverbankcomputing.comwrote: On Fri, 3 Dec 2010 15:46:55 +0100, KONTRA, Gergely pihent...@gmail.com wrote: Hi! I am trying to connect the beforeInsert signal of a QSqlTableModel, and having some problems. I've found this similar thread: http://www.mail-archive.com/pyqt@riverbankcomputing.com/msg20117.html However, I am using pyqt with py3k, so I prefer the new style signal and slots, but I appreciate any working solution... So my attempt based on the thread: class BatteryMain(base_class, form_class): # ... def cycle_started(self, record): print(Inserting {!r}.format(record)) def battery_load(self, filename): self.cycles_model = QSqlTableModel(db=self.battery_db) self.connect(self.cycles_model, SIGNAL(beforeInsert(QSqlRecord )), self.cycle_started) RESULT: QObject::connect: Cannot queue arguments of type 'QSqlRecord' (Make sure 'QSqlRecord' is registered using qRegisterMetaType().) Another attempt with new style signals and slots: class BatteryMain(base_class, form_class): # ... @pyqtSlot('QSqlRecord ') def cycle_started(self, record): print(Inserting {!r}.format(record)) def battery_load(self, filename): self.cycles_model = QSqlTableModel(db=self.battery_db) self.cycles_model.beforeInsert.connect(self.cycle_started) RESULT: File D:\prg\biQazo\biQazo.py, line 145, in battery_load self.cycles_model.beforeInsert.connect(self.cycle_started) TypeError: connect() failed between beforeInsert(QSqlRecord) and unislot() Could anybody tell me the correct syntax, please? It's not a syntax problem. Are you using threads? Yes, I am using threads. Is it valid to insert into a QSqlTableModel a new row in a QThread? I have a worker thread, which collects data, and inserts it into the QSqlTableModel, and I'd like to get notified with this beforeInsert signal in the GUI thread. I would guess that you can't use signals that take a QSqlRecord across threads, probably because they are not passed as const (to allow them to be updated by a connected slot). That sounds sad. I thought this signal will make it easy to communicate between threads. Then what is the solution to communicate between the worker thread, and the main GUI thread? Cutsom signal? thanks Gergo ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QSqlTableModel.beforeInsert signal (new style signal/slot)
On Fri, 3 Dec 2010 17:19:00 +0100, KONTRA, Gergely pihent...@gmail.com wrote: On Fri, Dec 3, 2010 at 16:06, Phil Thompson p...@riverbankcomputing.comwrote: On Fri, 3 Dec 2010 15:46:55 +0100, KONTRA, Gergely pihent...@gmail.com wrote: Hi! I am trying to connect the beforeInsert signal of a QSqlTableModel, and having some problems. I've found this similar thread: http://www.mail-archive.com/pyqt@riverbankcomputing.com/msg20117.html However, I am using pyqt with py3k, so I prefer the new style signal and slots, but I appreciate any working solution... So my attempt based on the thread: class BatteryMain(base_class, form_class): # ... def cycle_started(self, record): print(Inserting {!r}.format(record)) def battery_load(self, filename): self.cycles_model = QSqlTableModel(db=self.battery_db) self.connect(self.cycles_model, SIGNAL(beforeInsert(QSqlRecord )), self.cycle_started) RESULT: QObject::connect: Cannot queue arguments of type 'QSqlRecord' (Make sure 'QSqlRecord' is registered using qRegisterMetaType().) Another attempt with new style signals and slots: class BatteryMain(base_class, form_class): # ... @pyqtSlot('QSqlRecord ') def cycle_started(self, record): print(Inserting {!r}.format(record)) def battery_load(self, filename): self.cycles_model = QSqlTableModel(db=self.battery_db) self.cycles_model.beforeInsert.connect(self.cycle_started) RESULT: File D:\prg\biQazo\biQazo.py, line 145, in battery_load self.cycles_model.beforeInsert.connect(self.cycle_started) TypeError: connect() failed between beforeInsert(QSqlRecord) and unislot() Could anybody tell me the correct syntax, please? It's not a syntax problem. Are you using threads? Yes, I am using threads. Is it valid to insert into a QSqlTableModel a new row in a QThread? I have a worker thread, which collects data, and inserts it into the QSqlTableModel, and I'd like to get notified with this beforeInsert signal in the GUI thread. I would guess that you can't use signals that take a QSqlRecord across threads, probably because they are not passed as const (to allow them to be updated by a connected slot). That sounds sad. I thought this signal will make it easy to communicate between threads. Then what is the solution to communicate between the worker thread, and the main GUI thread? Cutsom signal? Yes, or a custom event (which is how cross-thread signals are handled anyway). Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QSqlTableModel.rowCount bug? (and still need infor for beforeInsert)
On 03.12.10 17:13:31, KONTRA, Gergely wrote: On Fri, Dec 3, 2010 at 15:56, Wolfgang Rohdewald wolfg...@rohdewald.dewrote: On Freitag 03 Dezember 2010, KONTRA, Gergely wrote: Hi all! I suspect QSqlTableModel.rowCount cannot return numbers above 256. rowCount is not the number of rows in the table but in the model, AFAIK. Use fetchMore() to load more. Thats not logical. http://doc.trolltech.com/4.7/qsqltablemodel.html#rowCountdoesn't mention what is exactly rowCount, and one should expect the number of rows based on the name... It also doesn't mention that its based on QSqlQueryModel::rowCount(). That one however does explain what it returns in its API docs. So it seems like your DB is at fault, as its not able to return the complete size of the query. Andreas -- You too can wear a nose mitten. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QSqlTableModel.rowCount bug? (and still need infor for beforeInsert)
On Freitag 03 Dezember 2010, Andreas Pakulat wrote: It also doesn't mention that its based on QSqlQueryModel::rowCount(). That one however does explain what it returns in its API docs. So it seems like your DB is at fault, as its not able to return the complete size of the query. You are right. The Qt SQLITE driver returns False for hasFeature(QSqlDriver.QuerySize) -- Wolfgang ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] bug: Python 2 exception in PyQt-Py3.1-gpl-4.8.1-1
While running cx_freeze with an installation of PyQt-Py3.1-gpl-4.8.1-1, I got the following error: File C:\Python31\lib\site-packages\PyQt4\uic\port_v2\load_plugin.py, line 17 except Exception, e: ^ SyntaxError: invalid syntax make: *** [freeze] Error 1 Changing the line to a Python 3 style exception fixed it: except Exception as e: Dan. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] bug: Python 2 exception in PyQt-Py3.1-gpl-4.8.1-1
On Friday 03 December 2010, 21:47:06 Daniel Goertzen wrote: While running cx_freeze with an installation of PyQt-Py3.1-gpl-4.8.1-1, I got the following error: File C:\Python31\lib\site-packages\PyQt4\uic\port_v2\load_plugin.py, ^^^ line 17 except Exception, e: ^ SyntaxError: invalid syntax make: *** [freeze] Error 1 Changing the line to a Python 3 style exception fixed it: except Exception as e: but it should have picked up port_v3, if things would had gone right. For some reason, cx_freeze picked the wrong interpreter. You may also try using PyInstaller, which has explicit PyQt4 support. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] bug: Python 2 exception in PyQt-Py3.1-gpl-4.8.1-1
Ah, sounds like a cx_freeze problem them. Other than that issue, cx_freeze appeared to work fine. The pyInstaller homepage says that it only supports up to python 2.7. Since I'm using 3.1, I didn't even try it. Thanks, Dan. On Fri, Dec 3, 2010 at 4:21 PM, Hans-Peter Jansen h...@urpla.net wrote: On Friday 03 December 2010, 21:47:06 Daniel Goertzen wrote: While running cx_freeze with an installation of PyQt-Py3.1-gpl-4.8.1-1, I got the following error: File C:\Python31\lib\site-packages\PyQt4\uic\port_v2\load_plugin.py, ^^^ line 17 except Exception, e: ^ SyntaxError: invalid syntax make: *** [freeze] Error 1 Changing the line to a Python 3 style exception fixed it: except Exception as e: but it should have picked up port_v3, if things would had gone right. For some reason, cx_freeze picked the wrong interpreter. You may also try using PyInstaller, which has explicit PyQt4 support. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt -- Daniel Goertzen - d...@networkintegritysystems.com (work) daniel.goert...@gmail.com (home) - 1 204 272 6149 (home/office) 1 204 470 8360 (mobile) - ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt