[PyQt] Event loop is already running warning message

Darren Dale darren.dale at cornell.edu
Thu Feb 7 15:16:32 GMT 2008


On Thursday 07 February 2008 07:14:41 am Phil Thompson wrote:
> On Tuesday 05 February 2008, Darren Dale wrote:
> > Hello,
> >
> > A while back I inquired about some warning messages that appear in a
> > threaded application at each timeout, which was addressed in a subsequent
> > PyQt4 release:
> > http://thread.gmane.org/gmane.comp.python.pyqt-pykde/9800/focus=9803
> >
> > A similar problem occurs with QCoreApplication, it can be seen by
> > starting ipython:
> >
> > $ ipython --q4thread
> >
> > >>> cpaste
> >
> > QCoreApplication::exec: The event loop is already running
> > QCoreApplication::exec: The event loop is already running
> > ...
> > That warning is also produced at each timeout. Is it possible to silence
> > this message?
> >
> > Thank you,
> > Darren
>
> It's not quite the same issue as before because if you change your original
> test to use QCoreApplication rather than QApplication then there is no
> problem.
>
> It would seem to be an ipython problem. PyQt now does some of what ipython
> does and the two implementations will conflict. PyQt allows its own
> implementation to be disabled - but I don't know if ipython takes advantage
> of that. The relevant functions are QtCore.pyqtRemoveInputHook() and
> QtCore.pyqtRestoreInputHook().

You are right, thank you for pointing this out. I spent some time this morning 
investigating whether ipython could use PyQt's implementation. For plotting 
with pylab the answer appears to be yes, but if you want to interact with 
PyQt4 after calling exec_, I think it is still necessary to use ipython's 
implementation. Thank you for providing pyqtRemoveInputHook.

Darren


More information about the PyQt mailing list