On Sep 23, 11:57 am, Jean-Michel Pichavant <jeanmic...@sequans.com> wrote: > akonsu wrote: > > hello, > > > my script creates files that i need to delete if an exception is > > thrown. > > > is this a good pythonic style to do this kind of cleanup in > > sys.excepthook instead of inside except clause of a try block? > > > konstantin > > def doIt(): > pass > > try: > doIt() > except Exception, exc: > #cleaning up files > > I mean, what is the problem with try except ? It's pythonic. If you tell > us what wrong with it in your case, we may spend time on hacking > sys.excepthook. > > Jean-Michel
thanks. nothing is wrong with try/except. i just already have an excepthook handler that uses logger to send emails if a critical error occurs, so i was just thinking that maybe i can add cleanup there. i agree, try/except makes more sense. konstantin -- http://mail.python.org/mailman/listinfo/python-list