Annoying message when interrupting python scripts

John Machin sjmachin at lexicon.net
Wed Jun 18 01:51:12 CEST 2008


On Jun 18, 12:51 am, geoffbache <geoff.ba... at jeppesen.com> wrote:
[snip]
> Is this a bug? I couldn't find any code, but I imagine something like
> try:
>      import site
> except:
>      sys.stderr.write("import site failed; use -v for traceback\n")
>
> which should surely allow a KeyboardInterrupt exception through?
>

Surely?? A bare "except" catches *all* remaining uncaught exceptions.
Allowing a KeyboardInterrupt exception through would require:
   except KeyboardInterrupt:
      pass



More information about the Python-list mailing list