Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Exception raised in wrong thread?

Reply
Thread Tools

Exception raised in wrong thread?

 
 
pegazik
Guest
Posts: n/a
 
      09-19-2005
Hello.

I have problem and I'm looking for help. Probably there is some quite
easy solution, but I can't see it.

I'm trying to perform some action that have to be timeout safe. So here
is the structure of my program:

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
def TimeoutHandler():
print '!'
raise Exception

class Active:
def Action:
timer = Timer(1, TimeoutHandler)
print '1'
timer.start()
try:
print '2'
time.sleep(20)
print '3'
except:
print '4'
else:
print '5'
timer.cancel()
print '6'

active = Actice()

///////////////////////////////////////////
The output is:
12!356

My question is, why exception is not raised correctly? Could be the
reason that (probably) timer is another thread and there is no
exception in the main thread? How to solve this problem? [My timeout
should be smaller than one second so I can't use signal.alarm()]

Thanks for your reply,
Krzysztof Nowak

 
Reply With Quote
 
 
 
 
Piet van Oostrum
Guest
Posts: n/a
 
      09-20-2005
Please don't post the same question twice with different subjects.
--
Piet van Oostrum <(E-Mail Removed)>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Page not displaying when exception raised pbo.spam@gmail.com ASP .Net 5 11-07-2005 02:13 PM
: an exception raised =?Utf-8?B?SklNLkgu?= ASP .Net 9 06-03-2005 03:22 PM
exception raised for valid variable declaration? Carlos ASP .Net 1 02-17-2005 08:26 PM
Exception feature creep! (was: re-entering in the normal flow after an exception is raised) Lonnie Princehouse Python 8 10-02-2004 09:16 PM
Exception raised tropicoorion Python 0 02-14-2004 03:02 PM



Advertisments