[PyQt] Advice for thread/process output logging, Windows debugging

Steve Borho steve at borho.org
Thu Sep 16 20:48:29 BST 2010


Before I get to my questions, I want to congratulate you folks for
such a tremendous toolkit.   I can only imagine how much further along
TortoiseHg would be today if we had selected PyQt from the start
(which was my suggestion at the time).

Our port from PyGtk is progressing very well, but we've run into a few
snags that I would like some advice about.  Both have to do with
Mercurial commands running as Python code in a Qthread.  We're giving
Mercurial a modified "user interface" object that captures output
messages and progress reports and emits them as PyQt signals [1].

What we've found is that this is fairly inefficient; commands run an
order of magnitude slower than they do on the console, and they get
progressively slower the longer the application is alive.  I'm
contemplating various buffering techniques to cut down on the number
of signals, but I'm curious if people have other suggestions for
making this more efficient.

The second problem is that on Windows this setup can cause hard
crashes after spewing a number of messages to the console like
'QObject::KillTimers: timers cannot be stopped from another thread'.
Disabling the output and progress signals does not prevent these
crashes, they seemed to be triggered by garbage collection, but I've
been unable to determine which objects are the problematic ones.  And
I've been unable to reproduce the crash on Linux or Mac.   What's the
best way to debug this?   I've downloaded the Python source and
compiled a python_d.exe and dll, but even though I thought I built the
same revision as the 2.6.5 release I have installed, it appears to
reject all the compiled modules in my C:\Python26 folder.

Is there a way to make PyQt emit more verbose error messages?

-- 
Steve Borho

[1] http://bitbucket.org/tortoisehg/thg/src/tip/tortoisehg/hgqt/thread.py


More information about the PyQt mailing list