[issue26108] Calling PyInitialize with 2.7.11 on Windows x64 terminates process
Eryk Sun
report at bugs.python.org
Thu Jan 14 07:52:23 EST 2016
Eryk Sun added the comment:
Probably this is related to issue 25824. When built as a console application and run from the command prompt, you should see an the error
ImportError: No module named site
If that's the case, the problem is that even the 64-bit build is incorrectly setting the DLL version string to "2.7-32":
0:000> da poi(python27!PyWin_DLLVersionString)
00000000`50b878c0 "2.7-32"
So the interpreter is looking at the wrong registry key to get the default sys.path:
python27!getpythonregpath+0x110:
00000000`509a3d90 ff15b2d20500 call qword ptr
[python27!_imp_RegOpenKeyExA (00000000`50a01048)]
ds:00000000`50a01048=
{ADVAPI32!RegOpenKeyExAStub (00007ffb`56f87d70)}
0:000> da @rdx
00000037`e4fd9940 "Software\Python\PythonCore\2.7-3"
00000037`e4fd9960 "2\PythonPath"
As a workaround, before calling Py_Initialize, add Py_SetPythonHome("C:\\Python27"), or wherever you installed Python. Or create a symbolic link to Python's Lib directory in the directory that has your executable:
mklink /d Lib "C:\Python27\Lib"
Or 'fix' the "SOFTWARE\Python\PythonCore\2.7" registry key by renaming it to "2.7-32". Or downgrade to 2.7.10 until 2.7.12 is released.
That said, probably you'll use a zipped library if distributing an application, in which case this shouldn't be a problem.
----------
nosy: +eryksun
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26108>
_______________________________________
More information about the Python-bugs-list
mailing list