This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author cmeyer
Recipients cmeyer, shihai1991, vstinner
Date 2020-11-11.17:46:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> How do you configure sys.path currently? Do you parse a configuration file? Do you use a registry key on Windows?

We have several launch scenarios - but for the currently most common one, which is to launch using a separate, existing Python environment, we call Py_SetPythonHome and Py_SetPath with the home directory of the environment. Then, presumably, the more complete path gets set in either Py_Initialize or when we call PyImport_ImportModule(“sys”). I might have tracked the details down once, but I don't recall them. By the time our Python code starts running, sys.path is reasonably populated.

However, in another scenario, we launch with an embedded Python environment, essentially a virtual environment. In that case, we have a config file to explicitly add lib, DLLs, and site packages. But something goes wrong [cannot find/load the unicode DLL IIRC] unless we call site.addsitedir for each directory already in sys.path near the start of our Python portion of code. My notes point to two issues to explain this: and
Date User Action Args
2020-11-11 17:46:43cmeyersetrecipients: + cmeyer, vstinner, shihai1991
2020-11-11 17:46:43cmeyersetmessageid: <>
2020-11-11 17:46:43cmeyerlinkissue42260 messages
2020-11-11 17:46:43cmeyercreate