Python, ASP/IIS, KeyboardInterrupt

Mark Hammond MarkH at ActiveState.com
Tue Apr 24 10:48:25 EDT 2001


Jim Abrams wrote:

> I've been using Python to power my ASP pages and have come across this 
> dreaded KeyboardInterrupt error. After searching through archives it seems 
> that this is still an unanswered problem with the Ctrl-C handler?
> 
> Well it's been a becoming more of a problem lately so I tried to work around 
> it and this is what I came up with, any comments and help is greatly 
> appreciated.


This is possibly/hopefully fixed in win32all-139 and ActivePython 210.

> Also if anyone has a better idea what do to with the SIGINT instead of 
> ignoring it that would help too.


If the problem is what I suspect, and have witnessed using xpcom, then 
the interrupt signal is sent at some time other than when Python is 
executing, but Python's signal handler sees it anyway and sets it 
pending.  When Python is next called, this pending exception is then 
thrown and the COM call fails.

So if this is indeed the case, then ignoring it is reasonable as it is 
not Python code that was interrupted!  And if it is not the case, my fix 
in the builds referenced above will not be a fix at all!

Mark.




More information about the Python-list mailing list