From: Thomas Heller Date: Thu, 3 Feb 2005 20:09:24 +0000 (+0000) Subject: Set PYTHONHOME before loading Python, so that sys.path will be set correctly. X-Git-Tag: v2.4.1c1~58 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=698fcf469bde83c9528e1ef90271dfa8628abd02;p=thirdparty%2FPython%2Fcpython.git Set PYTHONHOME before loading Python, so that sys.path will be set correctly. Already backported. --- diff --git a/PC/bdist_wininst/install.c b/PC/bdist_wininst/install.c index 44a6e0eec8aa..6a9bccb61353 100644 --- a/PC/bdist_wininst/install.c +++ b/PC/bdist_wininst/install.c @@ -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,