Thomas Heller writes: [...] > >> Is it worth providing an alternative initialization API that allows > >> these values to be specified explicitly instead of having them > >> computed? Or is there a reason not to do this? > > Wouldn't a Py_SetPath function do the trick, which would initially set > module_search_path (if it's not already set)? Yes, that is essentially what I propose adding: void Py_SetPaths(modulepath, prefix, execprefix, fullpath); It needs to do more than just set module_search_path though, since as a side effect of determining module_search_path, calculate_path() also sets the values for prefix, exec_prefix, and prog_path which are returned by Py_GetPrefix, Py_GetExecPrefix, and Py_GetProgramFullPath respectively, which are used by for sys.prefix and sys.exec_prefix, and sys.executable. Py_GetExecPrefix is also used by the _PyPopen function in posixmodule.c. In any event, the idea is that an embedding application may know the values for each of these paths and can force them by calling Py_SetPaths prior to Py_Initialize, with the appropriate caveat that the caller better know what they are doing or strange things might happen. -tree -- Tom Emerson Basis Technology Corp. Software Architect http://www.basistech.com "Beware the lollipop of mediocrity: lick it once and you suck forever"
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4