RuntimeError: cannot unmarshal code objects in restricted execution mode

Denis S. Otkidach ods at strana.ru
Thu Mar 11 15:14:45 CET 2004


More accurate: the problem is when module has compiled version
(.pyc), so I can run the script first time without error.

DSO> When I execute python code from C++ application with
DSO> PyEval_EvalCode and this code contains imports of other
DSO> modules
DSO> then I got the error "RuntimeError: cannot unmarshal code
DSO> objects
DSO> in restricted execution mode".  How can I switch into
DSO> noraml (unrestricted) mode?
DSO>
DSO> Python 2.2.2, Linux. Actual code looks like the following:
DSO>
DSO> tstate = Py_NewInterpreter();
DSO> main_module = PyImport_AddModule("__main__");
DSO> main_dict = PyModule_GetDict(main_module);
DSO> obj_res = PyEval_EvalCode(calc_code, main_dict, main_dict);

-- 
Denis S. Otkidach
http://www.python.ru/      [ru]





More information about the Python-list mailing list