Skip to content

Commit

Permalink
fix long-standing typo, use python3 compatible syntax for running pyt…
Browse files Browse the repository at this point in the history
…hon files
  • Loading branch information
davidlange6 committed Mar 2, 2019
1 parent 537b9c1 commit 43d21f7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion FWCore/ParameterSet/python/DictTypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
5 changes: 2 additions & 3 deletions FWCore/PyDevParameterSet/src/MakePyBind11ParameterSets.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)");
}
Expand Down
6 changes: 3 additions & 3 deletions FWCore/PyDevParameterSet/src/PyBind11ProcessDesc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)");
Expand Down

0 comments on commit 43d21f7

Please sign in to comment.