[Zconfig] 
	SVN: ZConfig/trunk/ZConfig/components/logger/loghandler.py
	suppress error triggered by the logging module in the atexit handler
    Fred L. Drake, Jr. 
    fdrake at gmail.com
       
    Wed Jun 20 13:57:06 EDT 2007
    
    
  
Log message for revision 76850:
  suppress error triggered by the logging module in the atexit handler
Changed:
  U   ZConfig/trunk/ZConfig/components/logger/loghandler.py
-=-
Modified: ZConfig/trunk/ZConfig/components/logger/loghandler.py
===================================================================
--- ZConfig/trunk/ZConfig/components/logger/loghandler.py	2007-06-20 17:46:43 UTC (rev 76849)
+++ ZConfig/trunk/ZConfig/components/logger/loghandler.py	2007-06-20 17:57:05 UTC (rev 76850)
@@ -37,6 +37,14 @@
 
     def close(self):
         self.stream.close()
+        # This can raise a KeyError if the handler has already been
+        # removed, but a later error can be raised if
+        # StreamHandler.close() isn't called.  This seems the best
+        # compromise.  :-(
+        try:
+            StreamHandler.close(self)
+        except KeyError:
+            pass
 
     def reopen(self):
         self.close()
    
    
More information about the ZConfig
mailing list