From: Vinay Sajip Date: Thu, 29 Jul 2004 09:19:30 +0000 (+0000) Subject: Ignore exceptions which occur when closing files in shutdown() X-Git-Tag: v2.4a2~106 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e12f71586ac4d3387fa635dd6617b4f8ebed083a;p=python Ignore exceptions which occur when closing files in shutdown() --- diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index e9bcf33ec4..8c63160c16 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -1256,8 +1256,13 @@ def shutdown(): Should be called at application exit. """ for h in _handlers.keys(): - h.flush() - h.close() + #errors might occur, for example, if files are locked + #we just ignore them + try: + h.flush() + h.close() + except: + pass #Let's try and shutdown automatically on application exit... try: