Best way for add new path when embedding python into C

Pau Freixes pfreixes at gmail.com
Mon Sep 1 07:22:43 EDT 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
misinterpreted.

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 site.py 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: <http://mail.python.org/pipermail/python-list/attachments/20080901/ef1f0e3a/attachment.html>


More information about the Python-list mailing list