From 4afd632055c59fb67e9924eb88aa06f4d447607c Mon Sep 17 00:00:00 2001 From: Tamas Date: Mon, 3 Oct 2022 02:11:49 +0200 Subject: [PATCH] Bugfix to the destructor of two TkDQM scripts --- DQM/SiStripMonitorClient/scripts/PhaseITreeProducer.py | 5 +++-- DQM/SiStripMonitorClient/scripts/TH2PolyOfflineMaps.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/DQM/SiStripMonitorClient/scripts/PhaseITreeProducer.py b/DQM/SiStripMonitorClient/scripts/PhaseITreeProducer.py index 7d221d37a86a3..192d05b2be5c2 100755 --- a/DQM/SiStripMonitorClient/scripts/PhaseITreeProducer.py +++ b/DQM/SiStripMonitorClient/scripts/PhaseITreeProducer.py @@ -314,8 +314,9 @@ def DumpData(self): print(len(self.availableNames)) def __del__(self): - if self.inputFile.IsOpen(): - self.inputFile.Close() + if self.inputFile: + if self.inputFile.IsOpen(): + self.inputFile.Close() #--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-- for i in range(1, len(sys.argv), 1): diff --git a/DQM/SiStripMonitorClient/scripts/TH2PolyOfflineMaps.py b/DQM/SiStripMonitorClient/scripts/TH2PolyOfflineMaps.py index 417e1d8d2b2d9..da263800df324 100755 --- a/DQM/SiStripMonitorClient/scripts/TH2PolyOfflineMaps.py +++ b/DQM/SiStripMonitorClient/scripts/TH2PolyOfflineMaps.py @@ -526,8 +526,9 @@ def PrintTrackerMaps(self): c1.Print(self.outputDirName + mv + ".png") def __del__(self): - if self.inputFile.IsOpen(): - self.inputFile.Close() + if self.inputFile : + if self.inputFile.IsOpen(): + self.inputFile.Close() #--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-- for i in range(1, len(sys.argv), 1):