Repository: dmwm/wmcore
Issue: Tier0 is not able to find physics_skims using the agent 1.5.2

**Impact of the bug**
Tier0 agent. Tier0Feeder is down due that is not able to find physics_skims for prompt-reco. Not able to lunch promt-reco and replay fails.

**Describe the bug**
With the T0 agent based on WMCore 1.5.2, the Tier0Feeder component is not able to find physics skims for promt-reco. If the dataset doesn't have physics_skims in the configuration as follows:
```
DATASETS = ["Cosmics"]
 
for dataset in DATASETS:
    addDataset(tier0Config, dataset,
               do_reco=True,
               write_reco=False,
               write_aod=True,
               write_miniaod=False,
               write_dqm=True,
               alca_producers=["SiStripCalCosmics","SiPixelCalCosmics","TkAlCosmics0T","MuAlGlobalCosmics"],
               #physics_skims=["CosmicSP", "CosmicTP", "LogError", "LogErrorMonitor"],
               timePerEvent=0.5,
               sizePerEvent=155,
               scenario=cosmicsScenario)
```
Tier0 is able to run prompt-reco but if physics_skims appear in the configuration the T0 agent is down and none of the promtreco workflows will run
**How to reproduce it**
Deploy T0 agent (3.0.0) based on WMCore 1.5.2

**Expected behavior**
Promptreco workflows should be able to run including the physics_skims parameter

**Additional context and error message**
Error message from the Componentlog is as follows:
`ERROR:StdBase:About to raise exception Can't find physics skim LogError in CMSSW_12_0_0`



Changed files:
src/python/WMCore/WMSpec/StdSpecs/StdBase.py

diff --git a/src/python/WMCore/WMSpec/StdSpecs/StdBase.py b/src/python/WMCore/WMSpec/StdSpecs/StdBase.py
index b05f1696a..4842b368b 100644
--- a/src/python/WMCore/WMSpec/StdSpecs/StdBase.py
+++ b/src/python/WMCore/WMSpec/StdSpecs/StdBase.py
@@ -10,6 +10,9 @@ from builtins import range, object
 
 import logging
 import json
+
+from Utils.PythonVersion import PY3
+from Utils.Utilities import decodeBytesToUnicodeConditional
 from Utils.Utilities import makeList, makeNonEmptyList, strToBool, safeStr
 from WMCore.Cache.WMConfigCache import ConfigCache, ConfigCacheException
 from WMCore.Lexicon import couchurl, procstring, activity, procversion, primdataset, gpuParameters
@@ -142,7 +145,8 @@ class StdBase(object):
         import subprocess
 
         p = subprocess.Popen("/cvmfs/cms.cern.ch/common/cmsos", stdout=subprocess.PIPE, shell=True)
-        cmsos = p.communicate()[0].strip()
+        cmsos = p.communicate()[0]
+        cmsos = decodeBytesToUnicodeConditional(cmsos, condition=PY3).strip()
 
         scramBaseDirs = glob.glob("/cvmfs/cms.cern.ch/%s*/cms/cmssw/%s" % (cmsos, cmsswVersion))
         if not scramBaseDirs:
@@ -154,12 +158,17 @@ class StdBase(object):
         command += "cd %s\\n" % scramBaseDirs[0]
         command += "eval `scramv1 runtime -sh`\\n"
 
-        command += """python -c 'from Configuration.StandardSequences.Skims_cff import getSkimDataTier\\n"""
+        if PY3:
+            command += """python3 -c 'from Configuration.StandardSequences.Skims_cff import getSkimDataTier\\n"""
+        else:
+            command += """python -c 'from Configuration.StandardSequences.Skims_cff import getSkimDataTier\\n"""
+
         command += """dataTier = getSkimDataTier("%s")\\n""" % skim
-        command += """if dataTier:\\n\\tprint dataTier.value()'"""
+        command += """if dataTier:\\n\\tprint(dataTier.value())'"""
 
         p = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True)
-        dataTier = p.communicate()[0].strip()
+        dataTier = p.communicate()[0]
+        dataTier = decodeBytesToUnicodeConditional(dataTier, condition=PY3).strip()
 
         if dataTier == "None":
             dataTier = None