]> 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>
Thu, 3 Feb 2005 20:09:24 +0000 (20:09 +0000)
committerThomas Heller <theller@ctypes.org>
Thu, 3 Feb 2005 20:09:24 +0000 (20:09 +0000)
Already backported.

PC/bdist_wininst/install.c

index 44a6e0eec8aa26954b7e60018918d54985d9b7a4..6a9bccb61353ef7d4ee191978cb89f888eebdb22 100644 (file)
@@ -613,7 +613,13 @@ static HINSTANCE LoadPythonDll(char *fname)
        char fullpath[_MAX_PATH];
        LONG size = sizeof(fullpath);
        char subkey_name[80];
-       HINSTANCE h = LoadLibrary(fname);
+       char buffer[260 + 12];
+       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,