The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Newsgroups: comp.lang.python
From: greg <g...@cosc.canterbury.ac.nz>
Date: Sat, 20 Jun 2009 16:09:08 +1200
Local: Sat, Jun 20 2009 12:09 am
Subject: Re: KeyboardInterrupt eats my error and then won't be caught
Philip Semanchuk wrote: Not sure exactly what's happening, but I think I can guess. > try: > sem.acquire() # User hits Ctrl + C while this is waiting > except: > print "********* I caught it!" > Instead a KeyboardInterrupt error is propagated up to the interpreter > and the process is killed as if the try/except wasn't there at all. Python installs a signal handler for Ctrl-C that sets a flag in the interpreter. Every so many bytecodes executed, the flag is checked and KeyboardInterrupt raised if it's set. So there can be a short delay between the Ctrl-C signal You could try using signal.signal() to install a handler -- You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||