Module import path when embedding python in C
graphaelli at gmail.com
Fri Sep 26 08:55:50 CEST 2008
something like this (plus error handling) seems to be the right way to
add to sys.path when embedding python in C:
PyObject *sys_path = PySys_GetObject("path");
PyObject *path = PyString_FromString("/your/path");
Does anyone know why PySys_GetObject wasn't documented until somewhat
recently (http://bugs.python.org/issue1245) if it has been part of the
system module interface since at least Python 1.5.2? Is it not
supposed to be used? What's the difference the above and importing
the sys module and then doing the append?
Thanks in advance.
More information about the Python-list