|
|
clipka <ano### [at] anonymousorg> wrote:
> Am 12.09.2016 um 22:13 schrieb LanuHum:
> > "LanuHum" <Lan### [at] yandexru> wrote:
> >>
> >> We will look for errors. :))))
> >
> > :(
> > If I uncommented Py_Finalize(), application crash when the command Py_Finalize()
> > run. If I do not use the import of bpy, the application lives
>
> Have you finished your other homework yet?
>
No. To learn your lesson, I started from scratch. I started all over again.
I wrote a single function.
The function must import the module, clean it and write "Hello World".
#include <python3.3m/Python.h>
#include <iostream>
int main() {
Py_Initialize();
PyRun_SimpleString("import sys");
PyRun_SimpleString("sys.path.append(\".\")");
PyObject *pyModuleName = PyUnicode_FromString("bimport");
PyObject *pyModule = PyImport_Import(pyModuleName);
Py_DECREF(pyModuleName);
Py_DECREF(pyModule);
Py_Finalize();
std::cout<<"Hello world!";
return 0;
}
The "bimport" module is only one row : import bpy
make and run.
Konsole wrote:
Blender quit
------------------
(program exited with code: 0)
Press return to continue...
Where is the "Hello World"?
I can rearrange some places line:
Py_DECREF(pyModule);
Py_DECREF(pyModuleName);
same result.
There is also need classes? In my opinion, it is a bug, and need a new idea.
Post a reply to this message
|
|