Catching a non-Exception object (KeyboardInterrupt)
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Mon Feb 4 09:34:01 EST 2008
En Mon, 04 Feb 2008 11:53:52 -0200, Michael Goerz
<answer654 at 8439.e4ward.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/pychecker/pychecker/CHANGELOG?view=markup
--
Gabriel Genellina
More information about the Python-list
mailing list