Alessandro Dentella wrote: > Voglio intercettare qualunque errore generato dalla applicazione che sto > facendo per poi inviarmi per mail la stack trace (e non chiedere al mio > cliente di inviarmela). prova con
---8<--- #!/usr/bin/python import sys import gtk import traceback orig=sys.excepthook def custom_exception(_type, _value, _traceback): traceback.print_exception(_type, _value, _traceback, file=open('error.log','a')) sys.excepthook=custom_exception class Test(object): def __init__(self): w = gtk.Window() b = gtk.Button("Press for an error") w.add(b) w.show_all() b.connect('clicked', self.on_clicked_error) def on_clicked_error(self, widget): print a t = Test() gtk.main() -- ()_() | That said, I didn't actually _test_ my patch. | +---- (o.o) | That's what users are for! | +---+ 'm m' | (Linus Torvalds) | O | (___) | raffaele at salmaso punto org | _______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python