예제 #1
0
void
python_init_prof(void)
{
#if PY_MAJOR_VERSION >= 3
    PyImport_AppendInittab("prof", python_api_init);
    Py_Initialize();
    PyEval_InitThreads();
#else
    Py_Initialize();
    PyEval_InitThreads();
    python_api_init();
#endif
}
예제 #2
0
void
python_env_init(void)
{
    Py_Initialize();
    PyEval_InitThreads();
    python_api_init();

    GString *path = g_string_new("import sys\n");
    g_string_append(path, "sys.path.append(\"");
    gchar *plugins_dir = plugins_get_dir();
    g_string_append(path, plugins_dir);
    g_free(plugins_dir);
    g_string_append(path, "/\")\n");

    PyRun_SimpleString(path->str);

    g_string_free(path, TRUE);
    allow_python_threads();
}