From 5c29a50cdc8eec0a10b9e2b14567130fbbbc5136 Mon Sep 17 00:00:00 2001 From: scott snyder <snyder@bnl.gov> Date: Sat, 9 Nov 2024 16:49:20 +0100 Subject: [PATCH 1/2] PyUtils: Don't assume that sys.stdout has a name attribute. In particular, it won't if we're being imported by something running from doctest. Fixes test failure in D3PDMakerCoreComps. --- Tools/PyUtils/python/PoolFile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tools/PyUtils/python/PoolFile.py b/Tools/PyUtils/python/PoolFile.py index c885c2e311cf..b04942167cb7 100644 --- a/Tools/PyUtils/python/PoolFile.py +++ b/Tools/PyUtils/python/PoolFile.py @@ -855,13 +855,13 @@ class PoolFile(object): print("is meaningless...") return - def detailedDump(self, bufferName = sys.stdout.name ): + def detailedDump(self, bufferName = None ): if self.poolFile is None or \ self.keys is None: print("Can't perform a detailedDump with a shelve file as input !") return - if bufferName == sys.stdout.name: + if bufferName == None: bufferName = "/dev/stdout" out = open( bufferName, "w" ) sys.stdout.flush() -- GitLab From 94cd54a24b68b6f1368f3128a74abbb4ef147aee Mon Sep 17 00:00:00 2001 From: scott snyder <snyder@bnl.gov> Date: Mon, 11 Nov 2024 04:33:17 +0100 Subject: [PATCH 2/2] fix flake8 warning --- Tools/PyUtils/python/PoolFile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/PyUtils/python/PoolFile.py b/Tools/PyUtils/python/PoolFile.py index b04942167cb7..a68044bc9d9f 100644 --- a/Tools/PyUtils/python/PoolFile.py +++ b/Tools/PyUtils/python/PoolFile.py @@ -861,7 +861,7 @@ class PoolFile(object): print("Can't perform a detailedDump with a shelve file as input !") return - if bufferName == None: + if bufferName is None: bufferName = "/dev/stdout" out = open( bufferName, "w" ) sys.stdout.flush() -- GitLab