diff --git a/HLTrigger/Tools/python/PDRates.py b/HLTrigger/Tools/python/PDRates.py index e9193cad000cc..674f8c250b532 100755 --- a/HLTrigger/Tools/python/PDRates.py +++ b/HLTrigger/Tools/python/PDRates.py @@ -1,8 +1,8 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 from __future__ import print_function import sys, imp import os -import commands +import subprocess from optparse import OptionParser @@ -32,7 +32,7 @@ def PrimaryDatasets(Run): dbs_cmd = """ dbs search --query='find primds.name where run=%d and dataset like */RAW' """ % (Run) - rows = commands.getoutput(dbs_cmd) + rows = subprocess.getoutput(dbs_cmd) lines = rows.split("\n") j=0 print("\nThe primary datasets for this run are: \n") @@ -52,7 +52,7 @@ def RateInPD(Run,PrimaryDataset,lsMin,lsMax,printLS=False): where run=%d and dataset like /%s/*/RAW and lumi >= %d and lumi <= %d and file.status=VALID '""" % (Run, PrimaryDataset,lsMin, lsMax) - rows = commands.getoutput(dbs_cmd) + rows = subprocess.getoutput(dbs_cmd) lines = rows.split("\n") j=0 LumiSections = [] diff --git a/HLTrigger/Tools/python/getHLTPrescaleColumns.py b/HLTrigger/Tools/python/getHLTPrescaleColumns.py index bf9a632c7126a..d2e8af4eb5275 100755 --- a/HLTrigger/Tools/python/getHLTPrescaleColumns.py +++ b/HLTrigger/Tools/python/getHLTPrescaleColumns.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from __future__ import print_function from __future__ import absolute_import from sys import stderr, exit -import commands +import subprocess from optparse import OptionParser parser = OptionParser(usage="usage: %prog [options] Trigger_Path") @@ -22,7 +22,7 @@ def getPrescalesFromKey(key): #stderr.write("\t%s ...\n" % key); cmd = ( edmCfgFromDB +" --configName "+key + " | grep -i "+ path + " | tail -1 | awk ' $2 ==\"%s\" {print $NL}' " ) % path - res = commands.getoutput(cmd) + res = subprocess.getoutput(cmd) res_split = res.split() psMap = {} aa="" diff --git a/HLTrigger/Tools/python/getHLTkey.py b/HLTrigger/Tools/python/getHLTkey.py index ae073c0f90a3f..f58273089eaba 100755 --- a/HLTrigger/Tools/python/getHLTkey.py +++ b/HLTrigger/Tools/python/getHLTkey.py @@ -1,8 +1,7 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from __future__ import print_function from __future__ import absolute_import from sys import stderr, exit -import commands # diff --git a/HLTrigger/Tools/python/getHLTprescales.py b/HLTrigger/Tools/python/getHLTprescales.py index 81f028f82dcfb..00051d8662ff3 100755 --- a/HLTrigger/Tools/python/getHLTprescales.py +++ b/HLTrigger/Tools/python/getHLTprescales.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from __future__ import print_function from __future__ import absolute_import from sys import stderr, exit -import commands +import subprocess from optparse import OptionParser parser = OptionParser(usage="usage: %prog [options] Trigger_Path") @@ -22,7 +22,7 @@ def getPrescalesFromKey(key): #stderr.write("\t%s ...\n" % key); cmd = ( edmCfgFromDB +" --configName "+key + " | grep -i "+ path + " | tail -1 | awk ' $2 ==\"%s\" {print $NL}' " ) % path - res = commands.getoutput(cmd) + res = subprocess.getoutput(cmd) res_split = res.split() psCols = [] if len(res)>0: diff --git a/HLTrigger/Tools/python/makeHLTPrescaleTable.py b/HLTrigger/Tools/python/makeHLTPrescaleTable.py index 9e7399c88f946..f673207a8ebaa 100755 --- a/HLTrigger/Tools/python/makeHLTPrescaleTable.py +++ b/HLTrigger/Tools/python/makeHLTPrescaleTable.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from __future__ import print_function from __future__ import absolute_import from sys import stderr, exit -import commands, os +import subprocess, os from optparse import OptionParser parser = OptionParser(usage= @@ -69,7 +69,7 @@ def getProcessObjectFromConfDB(hlt_key): # print >> stderr,"\t%s ..." % hlt_key cmd = "edmConfigFromDB --orcoff --configName " + hlt_key # print >> stderr, "cmd=",cmd - res = commands.getoutput(cmd) + res = subprocess.getoutput(cmd) # potentially dangerous: we're running python code here # which we get from an external process (confDB).