cleanup in sys.excepthook?

Jean-Michel Pichavant jeanmichel at sequans.com
Wed Sep 23 11:57:08 EDT 2009


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


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /