logging.Handler not working with QThreads

L

Lukas Hetzenecker

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
 
V

Vinay Sajip

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

I'm not sure what exactly your problem is - I had no problem running a
slightly modified version of your script. I don't have a version of Qt
with a QPlainTextEdit, so I used a plain QTextEdit instead ('scuse the
play on words). I also modified the thread run method slightly, like
so...

def run(self):
s = self.currentThreadId()
for i in range(10):
self.log.info("Thread %s (%d)", s, i)
self.sleep(1)

With these changes (and replacing the appendPlainText with just plain
append, the script worked fine. I was able to get messages from
multiple running threads and the main window/log window into the
single QTextEdit.

My testing was conducted on Kubuntu Hardy with SIP 4.7.9 and PyQt
4.4.4. The modified script is at

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

Best regards,

Vinay Sajip
 
V

Vinay Sajip

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top