Hi !

I think I found an example:

import sys

def info(type, value, tb):
   if hasattr(sys, 'ps1') or not sys.stderr.isatty():
      # we are in interactive mode or we don't have a tty-like
      # device, so we call the default hook
      print "yyy"
      sys.__excepthook__(type, value, tb)
   else:
      import traceback, pdb
      # we are NOT in interactive mode, print the exception...
      print "xxx"
      traceback.print_exception(type, value, tb)
      # ...then start the debugger in post-mortem mode.
      pdb.pm()

sys.excepthook = info

But I don't know it is working or not....

Thanx: ft

>
> Tárgy:
> Re: Python exception hook simple example needed
> Feladó:
> Benji York <[EMAIL PROTECTED]>
> Dátum:
> Tue, 05 Jul 2005 10:34:23 -0400
> Címzett:
> python-list@python.org
>
> Címzett:
> python-list@python.org
>
>
> [EMAIL PROTECTED] wrote:
>
>> If anyone has an idea, how to I catch exceptions globally, please 
>> write me.
>
>
> I believe there is an example of this in the demo that comes with 
> wxPython (don't have an install handy to check).
> -- 
> Benji York
>
>

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to