Alex Rivera | Logout

Python C API: Modify search path

Asked 2011-08-21T09:21:24.490
11

How can I add a speciific directory to the search path using the C API? And a related question: will the changes be local to the application, or is the search path global?

Edit
Report

1 Answer

15

You can update search path using the well-known Python code but called from within your C module:

PyRun_SimpleString(
   "import sys\n"
   "sys.path.append('/your/custom/path/here')\n"
);
answered 2011-08-27T00:11:36.577

Your Answer