[PyQt] kapplication not quiting

Jim Bublitz jbublitz at nwinternet.com
Mon Oct 29 16:36:40 GMT 2007

On Monday 29 October 2007 08:04, Andres Riancho wrote:
> Marcos,
> On 10/29/07, Marcos Dione <mdione at grulic.org.ar> 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.


More information about the PyQt mailing list