Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overriding sys.excepthook does not work #239

Open
tbabej opened this issue Dec 21, 2016 · 0 comments
Open

Overriding sys.excepthook does not work #239

tbabej opened this issue Dec 21, 2016 · 0 comments

Comments

@tbabej
Copy link
Contributor

tbabej commented Dec 21, 2016

Explicitly overriding sys.excepthook with your custom function does not work (sys.excepthook does contain the correct function object, but for some reason it never gets called). A regular traceback is displayed instead.

How to test

  1. Override sys.excepthook
     :py3file test.py

where test.py contains:

    from __future__ import print_function
    import sys

    def customhook(x,y,z):
        """
        My custom excepthook
        """
        print("Exception happened!")

    sys.excepthook = customhook

2, Raise an exception

:py3 raise Exception("No traceback please!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants