RuntimeError: cannot unmarshal code objects in restricted executionmode

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Denis S. Otkidach

    RuntimeError: cannot unmarshal code objects in restricted executionmode


    When I execute python code from C++ application with
    PyEval_EvalCode and this code contains imports of other modules
    then I got the error "RuntimeErr or: cannot unmarshal code objects
    in restricted execution mode". How can I switch into
    noraml (unrestricted) mode?

    Python 2.2.2, Linux. Actual code looks like the following:

    tstate = Py_NewInterpret er();
    main_module = PyImport_AddMod ule("__main__") ;
    main_dict = PyModule_GetDic t(main_module);
    obj_res = PyEval_EvalCode (calc_code, main_dict, main_dict);

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


Working...