FAQ
In my application embedding Python I want to have the standard Python
module path, so I try to achieve this by setting the program path to
that of the the interpreter. Even though I call Py_SetProgramName
before Py_InitializeEx, however, Python thinks the program path (as
returned by Py_GetProgramFullPath) is that of my embedding executable.

I would love if someone could explain what is going wrong here, and
eventually provide a better solution for inheriting the Python
interpreter's standard module path.

Test application demonstrating the problem.

#include <Python.h>

int main() {
// Hardcoded for simplicity
Py_SetProgramName("C:\\Python26\\python.exe");
Py_InitializeEx(0);
printf("Program path: %s\n", Py_GetProgramFullPath());
Py_Finalize();

return 0;
}


Thanks,
Arve Knudsen

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedJan 15, '09 at 4:02p
activeJan 15, '09 at 4:02p
posts1
users1
websitepython.org

1 user in discussion

Arve Knudsen: 1 post

People

Translate

site design / logo © 2022 Grokbase