This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: sys.excepthook does not work with -m command line switch
Type: Stage:
Components: Interpreter Core Versions: Python 2.5
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: tebeka
Priority: normal Keywords:

Created on 2007-02-02 19:27 by tebeka, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg31163 - (view) Author: Miki Tebeka (tebeka) * Date: 2007-02-02 19:27
crashlog.py is the following:
  import sys

  def excepthook(type, value, traceback):
      print "BUMMER"

  sys.excepthook = excepthook

When crash.py is like:
  import crashlog
  raise ValueError("so sad")

The it works as expected:
  [mtebeka@lakshmi - 11:22] ~ $python crash.py 
  BUMMER
  [mtebeka@lakshmi - 11:23] ~ $

However when I try to load crashlog using -m and leave crash.py like:
  raise ValueError("so sad")

The nothing (not even original excepthook is called):
  [mtebeka@lakshmi - 11:23] ~ $python -m crashlog crash.py
  [mtebeka@lakshmi - 11:25] ~ $

msg31164 - (view) Author: Miki Tebeka (tebeka) * Date: 2007-02-02 19:42
Didn't understand how -m works, my bad
History
Date User Action Args
2022-04-11 14:56:22adminsetgithub: 44540
2007-02-02 19:27:30tebekacreate