stdout and threads

T

Troels Thomsen

Hello All

I have trouble printing to stdout from a thread and main program.

Not only will it look strange when they try to print at the same time, that
is ok, but i think i see lock-ups. (strange exceptions in Tkinker etc) Or is
it an issue with IDLE ?

Should I implement a lock'ed / queued version and hook it into the
sys.stdout ?

(sorry if this has been answered recently in this group)

using
Python 2.5 (r25:51908
Idle 1.2

tpt
 
K

kyosohma

Hello All

I have trouble printing to stdout from a thread and main program.

Not only will it look strange when they try to print at the same time, that
is ok, but i think i see lock-ups. (strange exceptions in Tkinker etc) Or is
it an issue with IDLE ?

Should I implement a lock'ed / queued version and hook it into the
sys.stdout ?

(sorry if this has been answered recently in this group)

using
Python 2.5 (r25:51908
Idle 1.2

tpt

I've read in multiple sites/books that running Tkinter from IDLE can
cause screwy errors and I've seen a little bit of that behavior
myself. This website mentions the problem: http://www.ferg.org/thinking_in_tkinter/index.html
From what I've read in Lutz's book, Programming Python, it sounds like
using the Queue module for messages is a good way to go, using
producer and consumer threads. Then just check the queue from time to
time to grab the messages and print them out, maybe to a separate
text widget.

Mike
 

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
474,431
Messages
2,571,678
Members
48,796
Latest member
Greg L.

Latest Threads

Top