Author: Kristján Valur Jónsson (kristjan.jonsson) *
Date: 2010-09-21 06:32
When calling Py_Initialize() from an embedding application, there is currently no way for the application to override Python's initial settin g of sys.path. An elaborate mechanism in getpathp.c kicks in, guessing the path based on several criteria. Ideally, this mechanism, which is valid only for python.exe and its semantics, should be opt in. It forces embedders that have their own libraries to go through complicated hoops (with environment variables and what not) to direct their embedded interpreter at the right place for modules, and to make sure that it is not confused by any other python distribution present on the system. This submission adds a Py_SetPath() function to the API. This has been successfully used by CCP in EVE Online and other products to completely override python's path guessing mechanics. If called with a semicolon separated path prior to Py_Initialize, it will be used as the fodder for the initial sys.path.
Author: Kristján Valur Jónsson (kristjan.jonsson) *
Date: 2010-09-25 03:03
Right, forgot about getpath.c. Added documentation. See the latest version of the patch. Please note that I was unable to test the non-windows compile.