Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Catching a non-Exception object (KeyboardInterrupt)

Reply
Thread Tools

Catching a non-Exception object (KeyboardInterrupt)

 
 
Michael Goerz
Guest
Posts: n/a
 
      02-04-2008
Hi,

when I try to catch ctrl+c with

except KeyboardInterrupt:

pychecker tells me

Catching a non-Exception object (KeyboardInterrupt)

It works fine, but the message indicates that it's not completely clean.
How should I write the exception correctly?

Thanks,
Michael
 
Reply With Quote
 
 
 
 
Hrvoje Niksic
Guest
Posts: n/a
 
      02-04-2008
Michael Goerz <(E-Mail Removed)4ward.com> writes:

> when I try to catch ctrl+c with
>
> except KeyboardInterrupt:
>
> pychecker tells me
>
> Catching a non-Exception object (KeyboardInterrupt)


Looks like a pychecker bug. It might be confused by KeyboardInterrupt
being derived not from Exception, but from BaseException.
 
Reply With Quote
 
 
 
 
Duncan Booth
Guest
Posts: n/a
 
      02-04-2008
Hrvoje Niksic <(E-Mail Removed)> wrote:

> Michael Goerz <(E-Mail Removed)4ward.com> writes:
>
>> when I try to catch ctrl+c with
>>
>> except KeyboardInterrupt:
>>
>> pychecker tells me
>>
>> Catching a non-Exception object (KeyboardInterrupt)

>
> Looks like a pychecker bug. It might be confused by KeyboardInterrupt
> being derived not from Exception, but from BaseException.
>


There's a patch for this see:
https://thomas.apestaart.org/thomas/...t=diff&new=938
but it looks like pychecker isn't being maintained because nothing has
changed for more than 2 years.
 
Reply With Quote
 
Gabriel Genellina
Guest
Posts: n/a
 
      02-04-2008
En Mon, 04 Feb 2008 11:53:52 -0200, Michael Goerz
<(E-Mail Removed)4ward.com> escribi�:

> when I try to catch ctrl+c with
>
> except KeyboardInterrupt:
>
> pychecker tells me
>
> Catching a non-Exception object (KeyboardInterrupt)
>
> It works fine, but the message indicates that it's not completely clean.
> How should I write the exception correctly?


Your code is right; the latest official release of pychecker doesn't
support Python 2.5.
The exception hierarchy has changed a little, now you have BaseException
-> Exception -> all standard exceptions. KeyboardInterrupt and SystemExit
are now direct subclasses of BaseException, not of Exception.
According to the changelog [1] the development version does support 2.5

[1]
http://pychecker.cvs.sourceforge.net...OG?view=markup

--
Gabriel Genellina

 
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
catching object Igor V. Rafienko Python 2 03-14-2008 03:21 PM
catching signals in an object hg Python 1 01-15-2007 05:32 PM
Catching exceptions across shared object boundaries foxx C++ 4 08-31-2006 01:20 PM
Object creation - Do we really need to create a parent for a derieved object - can't the base object just point to an already created base object jon wayne C++ 9 09-22-2005 02:06 AM
How to catching loading exception? Bob ASP .Net 5 02-19-2005 07:07 AM



Advertisments