diff --git a/FWCore/ParameterSet/python/DictTypes.py b/FWCore/ParameterSet/python/DictTypes.py index 24903dc2f3d64..189b474f9eaec 100644 --- a/FWCore/ParameterSet/python/DictTypes.py +++ b/FWCore/ParameterSet/python/DictTypes.py @@ -48,7 +48,7 @@ def itervalues(self): def keys(self): return self.list def values(self): - return [ dict.__getitems__(self, key) for key in self.list] + return [ dict.__getitem__(self, key) for key in self.list] class SortedAndFixedKeysDict(SortedKeysDict): diff --git a/FWCore/PyDevParameterSet/src/MakePyBind11ParameterSets.cc b/FWCore/PyDevParameterSet/src/MakePyBind11ParameterSets.cc index 623c908ad2c9b..d28386fa7e002 100644 --- a/FWCore/PyDevParameterSet/src/MakePyBind11ParameterSets.cc +++ b/FWCore/PyDevParameterSet/src/MakePyBind11ParameterSets.cc @@ -10,9 +10,8 @@ static void makePSetsFromFile(std::string const& fileName) { std::string initCommand("from FWCore.ParameterSet.Types import makeCppPSet\n" - "execfile('"); - initCommand += fileName + "')"; - + "exec(open('"); + initCommand += fileName + "').read())"; pybind11::exec(initCommand); pybind11::exec("makeCppPSet(locals(), topPSet)"); } diff --git a/FWCore/PyDevParameterSet/src/PyBind11ProcessDesc.cc b/FWCore/PyDevParameterSet/src/PyBind11ProcessDesc.cc index 3d24668722316..df76d0827a9b6 100644 --- a/FWCore/PyDevParameterSet/src/PyBind11ProcessDesc.cc +++ b/FWCore/PyDevParameterSet/src/PyBind11ProcessDesc.cc @@ -73,9 +73,9 @@ void PyBind11ProcessDesc::read(std::string const& config) { } void PyBind11ProcessDesc::readFile(std::string const& fileName) { - std::string initCommand("import FWCore.ParameterSet.Config as cms\n" - "execfile('"); - initCommand += fileName + "')"; + std::string initCommand("from FWCore.ParameterSet.Types import makeCppPSet\n" + "exec(open('"); + initCommand += fileName + "').read())"; pybind11::exec(initCommand.c_str()); std::string command("process.fillProcessDesc(processPSet)");