[Tutor] re:A thread gui chat problem
Roman Suzi
rnd@onego.ru
Thu, 5 Jul 2001 08:52:44 +0400 (MSD)
On Thu, 5 Jul 2001, Daryl G wrote:
>I FIGURED IT OUT!!!!!!!!
>I'm a moron and a genius all in one?!?..... I hate it when I post a
>question, then figure it out.
It's very comman to solve something right after the formulation.
>I suddenly (5 minutes ago) decided to see what would happen f I put the data
>socket receive line inside a try statement in the thread run method
>And it WORKED!!
>
>Yippie!!!!
>I just don't know why that worked. Could anyone explain if possible please?
>Any additional suggestions are helpful too. Thanks!
>Also, to get a window to pop back up on top of other windows, would I use
>deiconify?
>
>New code in run method
>
>class msgThread(threading.Thread):
> def __init__(self):
>
>
>
> threading.Thread.__init__(self)
>
> def run(self):
>
> while 1:
> #put socket receive statement in try loop. Works now!!
> try:
> data=app.tcpCliSock.recv(1024)
> except:
> pass
Have you tried to output some debug info from here like
sys.exc_info()
(and print it with one of the module traceback functions
to some log-file?)
(I still feel like maybe your program is not correct, but am not
sure why, because have not dealt enough with threads.)
> app.recdata.set(data)
Sincerely yours, Roman Suzi
--
_/ Russia _/ Karelia _/ Petrozavodsk _/ rnd@onego.ru _/
_/ Thursday, July 05, 2001 _/ Powered by Linux RedHat 6.2 _/
_/ ">From the Department of Redundancy Dept." _/