[ python-Bugs-1650899 ] sys.excepthook does not work with -m command line switch

SourceForge.net noreply at sourceforge.net
Fri Feb 2 20:42:16 CET 2007


Bugs item #1650899, was opened at 2007-02-02 21:27
Message generated for change (Comment added) made by tebeka
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1650899&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.5
>Status: Closed
>Resolution: Invalid
Priority: 5
Private: No
Submitted By: Miki Tebeka (tebeka)
Assigned to: Nobody/Anonymous (nobody)
Summary: sys.excepthook does not work with -m command line switch

Initial Comment:
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 at lakshmi - 11:22] ~ $python crash.py 
  BUMMER
  [mtebeka at 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 at lakshmi - 11:23] ~ $python -m crashlog crash.py
  [mtebeka at lakshmi - 11:25] ~ $



----------------------------------------------------------------------

>Comment By: Miki Tebeka (tebeka)
Date: 2007-02-02 21:42

Message:
Logged In: YES 
user_id=358087
Originator: YES

Didn't understand how -m works, my bad

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1650899&group_id=5470


More information about the Python-bugs-list mailing list