From: Thomas Heller Date: Tue, 25 Jan 2005 19:47:48 +0000 (+0000) Subject: Set PYTHONHOME before loading Python, so that sys.path will be set correctly. X-Git-Tag: v2.3.5c1~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cf5d664ad18974ab66eeedcf401dbfba71388cee;p=thirdparty%2FPython%2Fcpython.git Set PYTHONHOME before loading Python, so that sys.path will be set correctly. --- diff --git a/PC/bdist_wininst/install.c b/PC/bdist_wininst/install.c index 878dc1b4cc2a..c9fe44ff1f84 100644 --- a/PC/bdist_wininst/install.c +++ b/PC/bdist_wininst/install.c @@ -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,