[IPython-dev] Ipython0, Ipython1, Qt, and threading...

Glenn H Tarbox, PhD glenn@tarbox....
Wed Apr 30 16:14:29 CDT 2008


I didn't think I'd run into this right out of the box... But it looks
like I'm getting bit by threading issues in ipython when using Qt4...

I'm using twisted inside ipython.  Its been straightforward till now...
but am having problems when using deferreds.

Basically, I make queries to remote servers which return values later.
I'm using the twisted Qt reactor I maintain
(http://code.tarbox.org/qtreactor) and it all worked pretty well until
recently...

In the current case, the deferred gets its return information across the
network.  The callback simply populates an object in the background...
so there's no IO or anything which should be occuring visably in
ipython.  

However, there appear to be threads running around which get unhappy.
PyQt has the unfortunate feature of just spewing error messages without
any traceback information (one of the truly bizarre and unfortunate
characteristics of PyQt and I haven't found a way to get useful
information from PyQt) so at this point I really don't know where in the
code this occurs and I get this kind of message output in the ipython
session:

QObject::killTimer: timers cannot be stopped from another thread
QObject::startTimer: timers cannot be started from another thread

what problems this is causing I'm unaware... everything seems to keep
working but this can't be good...

Since I'm running ipython with the Qt4Agg backend, I'm guessing a bunch
of Qt things get spawned by default... and I'm guessing that something
must be looking at IO... or there wouldn't be anything outside my code
which would otherwise see any events causing the above errors to be
generated

So, I'm kinda wondering whats happening.

Knowing that Ipython1 is using twisted, I figured I would try some of
that code to initiate whatever default reactor is used...
Unfortunately, same issue with other much nastier side effects... 

In particular, some of my other code generates a plot in a callback.
Using my Qt reactor, no problem... but using the Ipython1 reactor, the
application crashes because its very unhappy when gui activity occurs in
a non-gui thread... which appears to be the case with the default
reactor.

-glenn

-- 
Glenn H. Tarbox, PhD    | Don’t worry about people stealing your ideas. If your ideas
206-494-0819            | are any good, you’ll have to ram them down people’s throats
glenn@tarbox.org (gtalk) + ghtdak on aim/freenode     | ^ Howard Aiken, IBM engineer




More information about the IPython-dev mailing list