]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Set PYTHONHOME before loading Python, so that sys.path will be set correctly.
authorThomas Heller <theller@ctypes.org>
Tue, 25 Jan 2005 19:47:48 +0000 (19:47 +0000)
committerThomas Heller <theller@ctypes.org>
Tue, 25 Jan 2005 19:47:48 +0000 (19:47 +0000)
PC/bdist_wininst/install.c

index 878dc1b4cc2af397b1de3b8dfd38ab23e157d54a..c9fe44ff1f842d59411d1b52dfcb03f386015325 100644 (file)
@@ -1511,8 +1511,14 @@ static HINSTANCE LoadPythonDll(char *fname)
 {
        char fullpath[_MAX_PATH];
        char subkey_name[80];
+       char buffer[260 + 12];
        LONG size = sizeof(fullpath);
-       HINSTANCE h = LoadLibrary(fname);
+       HINSTANCE h;
+
+       /* make sure PYTHONHOME is set, to that sys.path is initialized correctly */
+       wsprintf(buffer, "PYTHONHOME=%s", python_dir);
+       _putenv(buffer);
+       h = LoadLibrary(fname);
        if (h)
                return h;
        wsprintf(subkey_name,