diff --git a/src/python/WMCore/Services/DBS/DBS3Reader.py b/src/python/WMCore/Services/DBS/DBS3Reader.py index ca55f44e3f9..ea792611b97 100644 --- a/src/python/WMCore/Services/DBS/DBS3Reader.py +++ b/src/python/WMCore/Services/DBS/DBS3Reader.py @@ -21,6 +21,7 @@ from retry import retry from Utils.IteratorTools import grouper +from Utils.PythonVersion import PY2 from WMCore.Services.DBS.DBSErrors import DBSReaderError, formatEx3 @@ -42,7 +43,7 @@ def remapDBS3Keys(data, stringify=False, **others): 'block_name': 'BlockName', 'lumi_section_num': 'LumiSectionNumber'} mapping.update(others) - formatFunc = lambda x: encodeUnicodeToBytes(x) if stringify else x + formatFunc = lambda x: encodeUnicodeToBytes(x) if PY2 and stringify else x for name, newname in viewitems(mapping): if name in data: data[newname] = formatFunc(data[name])