Command line and GUI tools : need a single threading solution
news at outbacklinux.com
Wed Jan 12 12:25:43 CET 2005
Adrian Casey wrote:
> Diez B. Roggisch wrote:
>>> I'm thinking it may be possible to modify the command line tools to use
>>> threads instead of native python threads. Is this the way to go? Are
>>> there other options?
>> Why don't you use python threads in qt - I do so and so far it didn't
>> make any troubles for me. And I would strongly advise against using
>> qthreads with your commandline-tools, as these then would only run on
>> machines where pyqt is installed - which opens a small part of
>> "dependency hell" for your users.
> I have a QThread which polls a queue object via queue.get(). The command
> line tools spawn a number of threads each of which writes its output to
> this queue using queue.put(). As soon as the gui gets something off the
> queue, it creates a QCustomEvent and sets the data property with the data
> read from the queue. My application has a customEvent() method which
> reads the data item from the customEvent and processes it accordingly.
> The odd thing is, I have a non-threaded version of the command line tools
> which work 100% with the gui. The multi-threaded version of the command
> line tools all work OK at the console - just not with the gui.
> I will try your suggestion and replace my QCustomEvent mechanism with a
> plain python queue.
I tried replacing the QThread part with native python threads and, although
it worked for a few minutes, I started to see XWindow errors and my
application would then crash.
On Phil Thompson's advice, I updated PyQt and sip. The problem appears to
More information about the Python-list