4

Every time my Python program ends, I get the following:

close failed in file object destructor:
IOError: [Errno 9] Bad file descriptor
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 66, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
RuntimeError: sys.meta_path must be a list of import hooks

Apport presumes it won't be the cause of more problems in case something goes wrong. In my case however, Apport seems to be a big problem.

I'm on a system where I'm just one of many programmers, and I don't have root privileges. So I'd like to make my Python program simply turn Apport off, but not turn Apport off globally.

How do I disable Apport for my user account?

1 Answer 1

1

This looks like a problem in Apport. I'd fill a bug, because there is no guarantee that you program won't fail on different environment if it causes Apport to crash.

If you really want to disable Apport for your program, try this:

if sys.excepthook != sys.__excepthook__:
   print("Warning: 3rd party exception hook is active")
   if sys.excepthook.__name__ == 'apport_excepthook':
       print("         killing Ubuntu's Apport hook")
       sys.excepthook = sys.__excepthook__

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .