Code:
function Py_Eval(const module, com, resultformat: string; const resultvalue: array of Pointer): Boolean;
var
pModule, pDict, pResult: PPyObject;
begin
Result := False;
pModule := PyImport_ImportModule(PChar(module));
if PyModule_Check(pModule) then
begin
pDict := PyModule_GetDict(pModule);
if PyDict_Check(pDict) then
begin
pResult := PyRun_String(PChar(com), eval_input, pDict, pDict);
if Assigned(pResult) then
begin
if PyArg_Parse(pResult, PChar(resultformat), resultvalue) <> 0 then
Result := True;
Py_DECREF(pResult);
end;
Py_DECREF(pDict);// ERROR HERE, WHY ? Don't Know!
end;
Py_DECREF(pModule);
end;
end;
im getting crazy with this stuff =.=
i tested exactly same code on C++ and works perfectly :roll:
Bookmarks