[PyQt] kapplication not quiting
List, I'm a pykde/pyqt newbie and I'm having some problems with kapplication that i'm almost sure you can help me with. I'm using a rather complex program, that in some place creates a kapplication object like this: kdecore.KCmdLineArgs.init(sys.argv[], test, , N) application = kdecore.KApplication() And then, I try to kill the object like this: application.processEvents() application.exit(0) application.quit() del application But when I try to create a new kapplication using the same lines I specified above, I get this error message: Qt debug: QApplication: There should be max one application object So, how do I kill/quit/exit/terminate/exterminate a KApplication in order to be able to create a new instance ? Thanks in advance, Cheers, -- Andres Riancho http://w3af.sourceforge.net/ Web Application Attack and Audit Framework ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] kapplication not quiting
On Mon, Oct 29, 2007 at 09:36:14AM -0300, Andres Riancho wrote: And then, I try to kill the object like this: application.processEvents() application.exit(0) application.quit() del application But when I try to create a new kapplication using the same lines I specified above, I get this error message: Qt debug: QApplication: There should be max one application object can you tell us where this code is run? can you post some more code, or even build a smaller example? ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] kapplication not quiting
Marcos, On 10/29/07, Marcos Dione [EMAIL PROTECTED] wrote: On Mon, Oct 29, 2007 at 09:36:14AM -0300, Andres Riancho wrote: And then, I try to kill the object like this: application.processEvents() application.exit(0) application.quit() del application But when I try to create a new kapplication using the same lines I specified above, I get this error message: Qt debug: QApplication: There should be max one application object can you tell us where this code is run? can you post some more code, or even build a smaller example? While I was trying to create a smaller example, I found another way of creating a crash. Please see the attached example. I will try to create an example that returns QApplication: There should be max one application object and i'll get back to you. Cheers, -- Andres Riancho http://w3af.sourceforge.net/ Web Application Attack and Audit Framework example.py Description: application/python ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] kapplication not quiting
On Monday 29 October 2007 08:04, Andres Riancho wrote: Marcos, On 10/29/07, Marcos Dione [EMAIL PROTECTED] wrote: On Mon, Oct 29, 2007 at 09:36:14AM -0300, Andres Riancho wrote: And then, I try to kill the object like this: application.processEvents() application.exit(0) application.quit() del application But when I try to create a new kapplication using the same lines I specified above, I get this error message: Qt debug: QApplication: There should be max one application object can you tell us where this code is run? can you post some more code, or even build a smaller example? While I was trying to create a smaller example, I found another way of creating a crash. Please see the attached example. I will try to create an example that returns QApplication: There should be max one application object and i'll get back to you. I don't have any supporting documentation on this (there may be something on the list two or three years ago or maybe even farther back), but I ran into a similar problem developing unit tests for PyKDE, where I wanted to construct and then tear down KApplication instances. The end result was that it isn't something you can do reliably within a single program. You either need to construct a single instance and reuse it, or fork a new process for each KApplication instance and then destroy the process when done with it.. I believe this is a KDE or Qt feature and not specific to PyKDE (and the error msg above is from Qt). I'm not really sure why it should be the case, but can think of a number of possible reasons. I'm fairly sure though that I did trace it back to some documentation that indicated it wasn't possible. Someone else can let me know if my memory is faulty. Jim ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] kapplication not quiting
Jim, On 10/29/07, Jim Bublitz [EMAIL PROTECTED] wrote: On Monday 29 October 2007 08:04, Andres Riancho wrote: Marcos, On 10/29/07, Marcos Dione [EMAIL PROTECTED] wrote: On Mon, Oct 29, 2007 at 09:36:14AM -0300, Andres Riancho wrote: And then, I try to kill the object like this: application.processEvents() application.exit(0) application.quit() del application But when I try to create a new kapplication using the same lines I specified above, I get this error message: Qt debug: QApplication: There should be max one application object can you tell us where this code is run? can you post some more code, or even build a smaller example? While I was trying to create a smaller example, I found another way of creating a crash. Please see the attached example. I will try to create an example that returns QApplication: There should be max one application object and i'll get back to you. I don't have any supporting documentation on this (there may be something on the list two or three years ago or maybe even farther back), but I ran into a similar problem developing unit tests for PyKDE, where I wanted to construct and then tear down KApplication instances. yes, I saw your post! The end result was that it isn't something you can do reliably within a single program. You either need to construct a single instance and reuse it, or fork a new process for each KApplication instance and then destroy the process when done with it.. hmmm...Interesting solution, i'll try to create some code with that. I believe this is a KDE or Qt feature and not specific to PyKDE (and the error msg above is from Qt). I'm not really sure why it should be the case, but can think of a number of possible reasons. I'm fairly sure though that I did trace it back to some documentation that indicated it wasn't possible. Ok, then I won't try to fix the code I have, I will have to rewrite it. Someone else can let me know if my memory is faulty. If someone can add something else to this issue, please do. -- Andres Riancho http://w3af.sourceforge.net/ Web Application Attack and Audit Framework ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt