logging.Handler not working with QThreads

Vinay Sajip vinay_sajip at yahoo.co.uk
Fri Feb 27 19:29:05 EST 2009


On Feb 25, 11:57 pm, Lukas Hetzenecker <L... at gmx.at> wrote:
> Hello,
>
> I created a QTextEdit where I wanted to display log messages.
> A logging.Handler should do this job.
>
> It worked with one thread well, but when I start a QThread the text on all
> widgets is removed and I get many errors in my konsole:
>
> X Error: RenderBadGlyphSet (invalid GlyphSet parameter) 177
>   Extension:    152 (RENDER)
>   Minor opcode: 25 (RenderCompositeGlyphs32)
>   Resource id:  0x0
> X Error: RenderBadGlyphSet (invalid GlyphSet parameter) 177
>   Extension:    152 (RENDER)
>   Minor opcode: 25 (RenderCompositeGlyphs32)
>   Resource id:  0x0
> X Error: RenderBadGlyphSet (invalid GlyphSet parameter) 177
>   Extension:    152 (RENDER)
>   Minor opcode: 25 (RenderCompositeGlyphs32)
>   Resource id:  0x0
>
> .. and so on
>
> I attatched a small example to this mail.
>
> Could anybody tell me what I'm doing wrong?
> Thanks for you help,
> Lukas
>
>  logging_error.py
> 3KViewDownload

Google seems to have swallowed my first attempt to reply, trying
again...

The following slightly modified script

http://dpaste.com/hold/2947/

seems to work as expected (see screenshot at
http://i722.photobucket.com/albums/ww224/vsajip/screenshot.png)

I just changed the script because my KDE doesn't have QPlainTextEdit,
so I used just plain QTextEdit instead. I also modified the thread run
method to loop over 10 seconds, so that I could show multiple threads
interleaving their output with messages from main window/log window.

Tested on Kubuntu (Hardy, KDE3) with SIP 4.7.9 and PyQt 4.4.4 running
on Qt 4.3.4.

Regards,

Vinay Sajip



More information about the Python-list mailing list