Catching a non-Exception object (KeyboardInterrupt)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michael Goerz

    #1

    Catching a non-Exception object (KeyboardInterrupt)

    Hi,

    when I try to catch ctrl+c with

    except KeyboardInterru pt:

    pychecker tells me

    Catching a non-Exception object (KeyboardInterr upt)

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

    Thanks,
    Michael
  • Hrvoje Niksic

    #2
    Re: Catching a non-Exception object (KeyboardInterr upt)

    Michael Goerz <answer654@8439 .e4ward.comwrit es:
    when I try to catch ctrl+c with
    >
    except KeyboardInterru pt:
    >
    pychecker tells me
    >
    Catching a non-Exception object (KeyboardInterr upt)
    Looks like a pychecker bug. It might be confused by KeyboardInterru pt
    being derived not from Exception, but from BaseException.

    Comment

    • Duncan Booth

      #3
      Re: Catching a non-Exception object (KeyboardInterr upt)

      Hrvoje Niksic <hniksic@xemacs .orgwrote:
      Michael Goerz <answer654@8439 .e4ward.comwrit es:
      >
      >when I try to catch ctrl+c with
      >>
      >except KeyboardInterru pt:
      >>
      >pychecker tells me
      >>
      >Catching a non-Exception object (KeyboardInterr upt)
      >
      Looks like a pychecker bug. It might be confused by KeyboardInterru pt
      being derived not from Exception, but from BaseException.
      >
      There's a patch for this see:

      but it looks like pychecker isn't being maintained because nothing has
      changed for more than 2 years.

      Comment

      Working...