[Zope-DB] KeyboardInterrupt in DCOracle2
jerry at longyouth.com
jerry at longyouth.com
Mon Nov 10 21:32:24 EST 2003
I am using python 2.2.3 on redhat box, and I am using DCOracle 1.2,as I said,I have try four types of error handling,but none catch the KeyboardInterrupt caught by dco2.c,the four type is:
* try...except KeyboardInterrupt
* try...except Exception
none can catch the KeyboardInterrupt,any new idea?
Tuesday, November 11, 2003, 5:08:21 AM, you wrote:
MTK> What he actually wants most likely is that the error code 1013
MTK> generated by Oracle is for some reason incorrect for his system.
MTK> In DCOracle2's dco2.c module, the Oracle 1013 error code (which should
MTK> be a keyboard interrupt) is translated to a KeyboardInterrupt
MTK> exception, rather than a normal DatabaseError exception.
MTK> Nothing guarantees that there aren't more than one Oracle error codes
MTK> that should be caught this way though.
MTK> 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
>>> 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: ...".
>> Zope-DB mailing list
>> Zope-DB at zope.org
jerry mailto:jerry at longyouth.com
More information about the Zope-DB