Annoying message when interrupting python scripts

geoffbache geoff.bache at jeppesen.com
Tue Jun 17 10:51:30 EDT 2008


Hi all,

I find that I semi-frequently get the cryptic message

import site failed; use -v for traceback

printed on standard error when an arbitrary python script receives
SIGINT while the python interpreter
is still firing up. If I use -v for traceback I get something along
the lines of

'import site' failed; traceback:
Traceback (most recent call last):
  File "/usr/lib/python2.4/site.py", line 61, in ?
    import os
  File "/usr/lib/python2.4/os.py", line 683, in ?
    import copy_reg as _copy_reg
  File "/usr/lib/python2.4/copy_reg.py", line 5, in ?
    """
KeyboardInterrupt

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?

Regards,
Geoff Bache



More information about the Python-list mailing list