Best way for add new path when embedding python into C

Pau Freixes pfreixes at
Mon Sep 1 13:22:43 CEST 2008

Hi list,

I have a little question about whats' the best way for add - no replace -
new path into python c embedding environment for this situation.

I'm using PyObject_CallObject(pfunc, pArgs); for call one function of some
module loaded with PyImport_Import function. PyImport_Import function search
this module into system path list object. I read some examples about
Py_GetPath and PySys_SetPath and i think some examples are wrong or can be

Py_GetPath make only a basic path, some sitautions are considred for make
this path, for example read environment varialbes.
PySys_SetPath overwrite all path list object.

When Py_Initialitze it's called sys path object is generated with Py_GetPath
content and a other directories added by file pre processor.

The best way for add new path before call PyImport_Import is adding new
string item into sys path object ?

Bye and thks to all

Pau Freixes
Linux GNU/User
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list