[Zope-DB] KeyboardInterrupt in DCOracle2

Matthew T. Kromer matt at zope.com
Mon Nov 10 16:08:21 EST 2003


What he actually wants most likely is that the error code 1013 
generated by Oracle is for some reason incorrect for his system.

In DCOracle2's dco2.c module, the Oracle 1013 error code (which should 
be a keyboard interrupt) is translated to a KeyboardInterrupt 
exception, rather than a normal DatabaseError exception.

Nothing guarantees that there aren't more than one Oracle error codes 
that should be caught this way though.


On Monday, November 10, 2003, at 02:34 PM, Dieter Maurer wrote:

> jerry at longyouth.com wrote at 2003-11-10 21:38 +0800:
>>   	I found that when the cursor is executing some insert sql and got 
>> a Ctrl-C from console,than I have no anyway to catch that exception,I 
>> have try using (except KeyboardInterrupt:/except:/except 
>> Exception/finally:),but none works,even worse is that the program 
>> just exist with a message saying "KeyboardInterrupt" and the cursor 
>> just commit everything(is this defined in the cursor clean-up 
>> function?).
>>
>> 	my question is:how can I catch KeyboardInterrupt from DCOracle2?
>
> You should set up your Zope in a way such that it does not
> get a "KeyboardInterrupt" under normal conditions.
>
> If this should really be not possible for you, then
> "try: ... except KeyboardInterrupt: ..." usually
> catches "KeyboardInterrupt".
>
> Note, however, that at least in Python 2.1.3 a bug may
> prevent the "try: ... except KeyboardInterrupt" to have
> an effect. This happens when the interrupt already caused
> a C level extensions (e.g. "dco2") to raise an exception.
> The "KeyboardInterrupt" is in this case seen to late,
> outside the "try: ... catch: ...".
> A workaround is to add an additional "try: ... except: ...".
>
> -- 
> Dieter
>
> _______________________________________________
> Zope-DB mailing list
> Zope-DB at zope.org
> http://mail.zope.org/mailman/listinfo/zope-db




More information about the Zope-DB mailing list