Kent,
   I'm using the same version (2.4.1) under Win XP. The program works as
expected (ie prints "run: <k>" a few times, and then just goes dead - no
errors. Having said that, I did see one instance where it ran to
completion under IDLE. So looks like the behaviour is not consistent.
Cheers
Hans

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Kent Johnson
Sent: Thursday, 25 August 2005 11:23 p.m.
Cc: [email protected]
Subject: Re: [Tutor] Differences in running a multithreaded script under
IDLE and otherwise

Hans Dushanthakumar wrote:
> Hi,
>    While running the foll script by double-clicking it (under WinXP), 
> it runs as expected. However, when I run it via IDLE, it hangs after a

> few secs (no runtime errors - just hangs). Why does this happen?

It works for me in IDLE with Python 2.4.1 on Win2k. What version of
Python do you have? Do you get any output at all?

Kent

> 
> Cheers
> Hans
> 
> import threading
> 
> class incr_num(threading.Thread):
>     num = ''
>     
>     def __init__(self, local_num):
>         global num
>         threading.Thread.__init__(self)
>         num = local_num
>         print "__init__: ", num
>         
>     def run(self):
>         global num
>         for k in range (20):
>             print "run: ", num
>             num = num + 1
> 
> incr_num_thread = incr_num(501)
> incr_num_thread.start()
> 
> print "Wait for thread to finish"
> incr_num_thread.join()
> print "Thread finished"
> 
> raw_input("Press enter")
> _______________________________________________
> Tutor maillist  -  [email protected]
> http://mail.python.org/mailman/listinfo/tutor
> 

_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to