From 63ed47b5d20c4fbbc1c988e6f14b455481e57a0c Mon Sep 17 00:00:00 2001 From: Shahzad Malik Muzaffar Date: Fri, 27 Sep 2019 08:35:23 +0200 Subject: [PATCH 1/2] Python3: changes needed to fix runTheMatrix errors for PY3 IBs --- Configuration/Applications/python/ConfigBuilder.py | 2 +- .../LHEInterface/scripts/cmsLHEtoEOSManager.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Configuration/Applications/python/ConfigBuilder.py b/Configuration/Applications/python/ConfigBuilder.py index edf92dac24100..0438d1bbb8549 100644 --- a/Configuration/Applications/python/ConfigBuilder.py +++ b/Configuration/Applications/python/ConfigBuilder.py @@ -143,7 +143,7 @@ def filesFromDASQuery(query,option="",s=None): if count!=0: print('Sleeping, then retrying DAS') time.sleep(100) - p = Popen('dasgoclient %s --query "%s"'%(option,query), stdout=PIPE,shell=True) + p = Popen('dasgoclient %s --query "%s"'%(option,query), stdout=PIPE,shell=True, universal_newlines=True) pipe=p.stdout.read() tupleP = os.waitpid(p.pid, 0) eC=tupleP[1] diff --git a/GeneratorInterface/LHEInterface/scripts/cmsLHEtoEOSManager.py b/GeneratorInterface/LHEInterface/scripts/cmsLHEtoEOSManager.py index 9a2aa6019e37c..51359809593d2 100755 --- a/GeneratorInterface/LHEInterface/scripts/cmsLHEtoEOSManager.py +++ b/GeneratorInterface/LHEInterface/scripts/cmsLHEtoEOSManager.py @@ -29,7 +29,7 @@ def articleExist(artId): itExists = False theCommand = defaultEOSlistCommand+' '+defaultEOSRootPath - dirList = subprocess.Popen(["/bin/sh","-c",theCommand], stdout=subprocess.PIPE) + dirList = subprocess.Popen(["/bin/sh","-c",theCommand], stdout=subprocess.PIPE, universal_newlines=True) for line in dirList.stdout.readlines(): if findXrdDir(line) == str(artId): itExists = True @@ -41,7 +41,7 @@ def lastArticle(): artList = [0] theCommand = defaultEOSlistCommand+' '+defaultEOSRootPath - dirList = subprocess.Popen(["/bin/sh","-c",theCommand], stdout=subprocess.PIPE) + dirList = subprocess.Popen(["/bin/sh","-c",theCommand], stdout=subprocess.PIPE, universal_newlines=True) for line in dirList.stdout.readlines(): try: if line.rstrip('\n') != '': @@ -261,7 +261,7 @@ def fileUpload(uploadPath,lheList, checkSumList, reallyDoIt): elif options.artIdLi !=0: listPath = defaultEOSRootPath+'/'+str(options.artIdLi) theCommand = defaultEOSlistCommand+' '+listPath - exeList = subprocess.Popen(["/bin/sh","-c",theCommand], stdout=subprocess.PIPE) + exeList = subprocess.Popen(["/bin/sh","-c",theCommand], stdout=subprocess.PIPE, universal_newlines=True) for line in exeList.stdout.readlines(): if findXrdDir(line) != None: print(findXrdDir(line)) From 9487130c32b4088798626a47e24f3bdf7c2f51b9 Mon Sep 17 00:00:00 2001 From: Shahzad Malik Muzaffar Date: Fri, 27 Sep 2019 09:27:14 +0200 Subject: [PATCH 2/2] fix addOnTest: write pickle file with protocol=2 so that it can be loaded using py2 --- Utilities/ReleaseScripts/scripts/addOnTests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utilities/ReleaseScripts/scripts/addOnTests.py b/Utilities/ReleaseScripts/scripts/addOnTests.py index 19f23a2e824e0..821568178e61c 100755 --- a/Utilities/ReleaseScripts/scripts/addOnTests.py +++ b/Utilities/ReleaseScripts/scripts/addOnTests.py @@ -194,7 +194,7 @@ def runTests(self, testList = None): os.system(cmd) import pickle - pickle.dump(self.commands, open('logs/addOnTests.pkl', 'w') ) + pickle.dump(self.commands, open('logs/addOnTests.pkl', 'wb'), protocol=2) os.chdir(actDir)