AddPythonPath adds a new path to the PYTHONPATH environment variable.
(path string)
| 75 | |
| 76 | // AddPythonPath adds a new path to the PYTHONPATH environment variable. |
| 77 | func AddPythonPath(path string) { |
| 78 | syspath := C.CString("path") |
| 79 | defer C.free(unsafe.Pointer(syspath)) |
| 80 | newPath := PyUnicodeFromString(path) |
| 81 | defer newPath.DecRef() |
| 82 | C.PyList_Append(C.PySys_GetObject(syspath), newPath.rawptr) |
| 83 | } |
| 84 | |
| 85 | // SetPath sets the default module search path. If this function is called before Py_Initialize(), then Py_GetPath() |
| 86 | // won’t attempt to compute a default search path but uses the one provided instead. This is useful if Python is |