6 #include <pybind11/embed.h> 7 #include <pybind11/pybind11.h> 15 : theProcessPSet(), theMainModule(), theOwnsInterpreter(
true) {
16 pybind11::initialize_interpreter();
25 theOwnsInterpreter(
true)
28 pybind11::initialize_interpreter();
32 #if PY_MAJOR_VERSION >= 3 33 typedef std::unique_ptr<wchar_t[], decltype(&PyMem_RawFree)> WArgUPtr;
34 std::vector<WArgUPtr> v_argv;
35 std::vector<wchar_t*> vp_argv;
37 vp_argv.reserve(
argc);
38 for (
int i = 0;
i <
argc;
i++) {
39 v_argv.emplace_back(Py_DecodeLocale(
argv[
i],
nullptr), &PyMem_RawFree);
40 vp_argv.emplace_back(v_argv.back().get());
43 wchar_t** argvt = vp_argv.data();
48 PySys_SetArgv(
argc, argvt);
56 pybind11::finalize_interpreter();
75 }
catch (pybind11::error_already_set
const&
e) {
88 command +=
"\nprocess.fillProcessDesc(processPSet)";
89 pybind11::exec(
command.c_str());
97 std::ostringstream os;
104 return std::make_unique<edm::ProcessDesc>(
parameterSet());
void initializePyBind11Module()
void pythonToCppException(const std::string &iType, const std::string &error)
Python11ParameterSet theProcessPSet
edm::ParameterSet & pset()
std::unique_ptr< edm::ParameterSet > parameterSet() const
pybind11::object theMainModule
void readFile(std::string const &fileName)
void read(std::string const &config)
cond::Hash import(Session &source, const cond::Hash &sourcePayloadId, const std::string &inputTypeName, const void *inputPtr, Session &destination)
void readString(std::string const &pyConfig)
std::unique_ptr< edm::ProcessDesc > processDesc() const