[PyQt] Cleaning up when unloading embedded Python + PyQt
I have a plugin that is loaded and unloaded by a KDE-based application on will. The plugin hosts Python and exposes the application's interface to Python scripts. I'm having a problem with a crash when unloading the plugin. From the traceback[1] it looks like events are being routed to PyQt even though I've successfully called Py_Finalize() and unloaded the Python library. Is there a standard way to clean up PyQt? The Designer plugin doesn't do any cleaning up, and I couldn't find any other examples to go on. Thanks, Paul [1] Traceback: Application: Kate (kate), signal SIGSEGV [Thread debugging using libthread_db enabled] [New Thread 0x7fc50e7fb700 (LWP 8090)] [New Thread 0x41ecc950 (LWP 8091)] [KCrash handler] #5 0x7fc501eed75d in PyThreadState_New () from /usr/lib64/libpython2.5.so.1.0 #6 0x7fc501eed7cc in PyGILState_Ensure () from /usr/lib64/libpython2.5.so.1.0 #7 0x7fc5017c0dbd in ?? () from /usr/lib64/python2.5/site-packages/PyQt4/QtCore.so #8 0x7fc50a868f6d in QObject::event () from /usr/lib64/libQtCore.so.4 #9 0x7fc50b30e17d in QApplicationPrivate::notify_helper () from /usr/lib64/libQtGui.so.4 #10 0x7fc50b315f2a in QApplication::notify () from /usr/lib64/libQtGui.so.4 #11 0x7fc50c801d9b in KApplication::notify () from /usr/lib64/libkdeui.so.5 #12 0x7fc50a859e81 in QCoreApplication::notifyInternal () from /usr/lib64/libQtCore.so.4 #13 0x7fc50a85ab3a in QCoreApplicationPrivate::sendPostedEvents () from /usr/lib64/libQtCore.so.4 #14 0x7fc50a882723 in ?? () from /usr/lib64/libQtCore.so.4 #15 0x7fc50589393a in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0 #16 0x7fc505897040 in ?? () from /usr/lib64/libglib-2.0.so.0 #17 0x7fc5058971dc in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0 #18 0x7fc50a8823af in QEventDispatcherGlib::processEvents () from /usr/lib64/libQtCore.so.4 #19 0x7fc50b39eccf in ?? () from /usr/lib64/libQtGui.so.4 #20 0x7fc50a858782 in QEventLoop::processEvents () from /usr/lib64/libQtCore.so.4 #21 0x7fc50a85890d in QEventLoop::exec () from /usr/lib64/libQtCore.so.4 #22 0x7fc50a85adfd in QCoreApplication::exec () from /usr/lib64/libQtCore.so.4 #23 0x7fc50e419e9d in kdemain (argc=3, argv=0x7fff168386e8) at /usr/src/debug/kdesdk-4.1.3/kate/app/katemain.cpp:252 #24 0x7fc506e83436 in __libc_start_main () from /lib64/libc.so.6 #25 0x004008c9 in _start () #0 0x7fc506f07261 in nanosleep () from /lib64/libc.so.6 ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Question about QListView
On Thu, 18 Dec 2008 13:11:19 +0100, Ralph Kube wrote: > Hey people, > I have a simple question about using QListView in my application. > Lets say, I want QListView to display a number of strings. > On the command line the following works: > > str_list = ['str1', 'str2', ... , 'strn'] > qstr = QStringList(str_list) > qstr_model = QStringListModel(qstr) > lv = QListView() > lv.setModel(qstr_model) > lv.show() > > I get a ListView with the strings in there. Great. > Now I got the following code in my app and it doesn't show anything: > > > class ListViewTest(QtGui.QMainWindow): > def __init__(self, *args): > apply(QtGui.QMainWindow.__init__, (self, ) + args) > > self.setGeometry(300, 300, 300, 50) > self.setWindowTitle('ListViewTest') > > qstr = QtCore.QStringList(QtCore.QString('foo')) > qstr_model = QtGui.QStringListModel(qstr) > self.lv = QtGui.QListView(self) > self.lv.move(120,10) > self.lv.setModel(qstr_model) > > self.pb = QtGui.QPushButton('Update', self) > self.pb.move(10,10) > > QtCore.QObject.connect(self.pb, QtCore.SIGNAL('clicked()'), > self.update_list) > > > def update_list(self): > > qstr = QtCore.QStringList(QtCore.QString('bar')) > qstr_model = QtGui.QStringListModel(qstr) > self.lv.setModel(qstr_model) > print 'Button pressed' > > > app = QtGui.QApplication(sys.argv) > mywin = ListViewTest() > mywin.show() > app.exec_() > > > Any ideas about that? I surely am confused. Keep an explicit reference to your model. It is being garbage collected. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Question about QListView
Hey people, I have a simple question about using QListView in my application. Lets say, I want QListView to display a number of strings. On the command line the following works: str_list = ['str1', 'str2', ... , 'strn'] qstr = QStringList(str_list) qstr_model = QStringListModel(qstr) lv = QListView() lv.setModel(qstr_model) lv.show() I get a ListView with the strings in there. Great. Now I got the following code in my app and it doesn't show anything: class ListViewTest(QtGui.QMainWindow): def __init__(self, *args): apply(QtGui.QMainWindow.__init__, (self, ) + args) self.setGeometry(300, 300, 300, 50) self.setWindowTitle('ListViewTest') qstr = QtCore.QStringList(QtCore.QString('foo')) qstr_model = QtGui.QStringListModel(qstr) self.lv = QtGui.QListView(self) self.lv.move(120,10) self.lv.setModel(qstr_model) self.pb = QtGui.QPushButton('Update', self) self.pb.move(10,10) QtCore.QObject.connect(self.pb, QtCore.SIGNAL('clicked()'), self.update_list) def update_list(self): qstr = QtCore.QStringList(QtCore.QString('bar')) qstr_model = QtGui.QStringListModel(qstr) self.lv.setModel(qstr_model) print 'Button pressed' app = QtGui.QApplication(sys.argv) mywin = ListViewTest() mywin.show() app.exec_() Any ideas about that? I surely am confused. Cheers, Ralph ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QSqlDatabase: available drivers: QSQLITE
On Donnerstag, 18. Dezember 2008, lucabe...@libero.it wrote: > I need to connect to mysql db but when i try i see that i have only availabe > the driver for sqlite, how can i add the mysql driver? maybe you need to install the package libqt4-sql-mysql (I am running ubuntu) -- Wolfgang ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Introducing PyDingo
Yesterday I've released PyDingo ALPHA 0.3 with some improvements over 0.2. The most important ones: - GIO backend (from pygobject) for suggesting applications for files - QScintilla text editor has basic features like save/saveAs/find/undo/redo - File metainfo widget can open a file in suggested apps - Binary package for MS Windows You can grab source and windows packages from google.code http://code.google.com/p/pydingo/downloads/list Sample screenshot: http://www.rkblog.rk.edu.pl/site_media/resources/python.rk.edu.pl/images/pydingo-gnome-apps.png - QGtkStyle, GNOME and apps for a file. For the next "release" the main feature will be adding basic file management features to the file browser, context menus, main menu, and some other smaller fixes and enchantments :) ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QSqlDatabase: available drivers: QSQLITE
2008/12/18 lucabe...@libero.it > Hello > I need to connect to mysql db but when i try i see that i have only > availabe the driver for sqlite, how can i add the mysql driver? > > Thanks > > Luca > > > ___ > PyQt mailing listPyQt@riverbankcomputing.com > http://www.riverbankcomputing.com/mailman/listinfo/pyqt > Compile Qt with MySQL support, then compile PyQt :) Or use mysql-python ;) ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] QSqlDatabase: available drivers: QSQLITE
Hello I need to connect to mysql db but when i try i see that i have only availabe the driver for sqlite, how can i add the mysql driver? Thanks Luca ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] no UDSEntryList in PyKDE leads to crash
Hi, sure, below is a small program which will crash when using KIO::UDSEntryList in a signal handler thanks, magnus (i am using python-qt4 4.4.3-1ubuntu1& python-kde4 4:4.1.3-0ubuntu1~intrepid1) #!/usr/bin/env python # -*- coding: utf-8 -*- import sys from PyQt4.QtCore import * from PyQt4.QtGui import * from PyKDE4.kdecore import ki18n, KAboutData, KCmdLineArgs, KUrl from PyKDE4.kdeui import KApplication, KMainWindow from PyKDE4.kio import * class KasablancaMainWindow (KMainWindow): listjob = None def __init__ (self): KMainWindow.__init__ (self) listjob = KIO.listDir(KUrl ("/" )) self.connect (listjob, SIGNAL ("result (KJob *)"), self.slotResult) self.connect (listjob, SIGNAL ("entries (KIO::Job *, const KIO::UDSEntryList &)"), self.slotEntries) def slotResult(self, job): print "result" def slotEntries(self, job, entrylist): print "entries" if __name__ == '__main__': appName = "kasablanca" catalog = "" programName = ki18n ("kasablanca") version = "0.5" description = ki18n ("kasablanca ftp client") license = KAboutData.License_GPL copyright = ki18n ("(c) 2008 Magnus Kulke") text= ki18n ("none") homePage= "kasablanca.berlios.de" bugEmail= "mku...@bla.com" aboutData = KAboutData (appName, catalog, programName, version, description, license, copyright, text, homePage, bugEmail) KCmdLineArgs.init (sys.argv, aboutData) app = KApplication () mainWindow = KasablancaMainWindow () mainWindow.show() app.exec_ () Am Dec 17, 2008 um 11:17 PM schrieb Simon Edwards: Hi, Magnus Kulke wrote: there is a signal in KDE, emitted by a KIO::ListJob, "entries (KIO::Job *, const KIO::UDSEntryList &). there seems to be no binding for this class in python. USDEntryList is really a typedef'ed QList KIO::UDSEntryList. Only UDSEntry seems to be available in PyKDE4. when connecting the signal to my slot the application crashes, anyone knows how to work around this? If you can boil the problem down to something simple enough that I can (reasonably) easily reproduce it here, then I'll have a look at it. cheers, -- Simon Edwards | KDE-NL, Guidance tools, Guarddog Firewall si...@simonzone.com | http://www.simonzone.com/software/ Nijmegen, The Netherlands | "ZooTV? You made the right choice." ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] ANN: new eric4 web site
Hi, please note, that the eric4 web site has been relocated. It is available via http://eric-ide.python-projects.org The old address will be redirected automatically. Regards, Detlev -- Detlev Offenbach det...@die-offenbachs.de ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt