New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to import "site" in an embedded application #71185
Comments
Unable to import "site" error occurs in an embedded application. I have run the python 2.7.11 x86 (for all users) at my win 7x64. In this case, the DLL was compiled with PyWin_DLLVersionString = "2.7-32". The PyWin_DLLVersionString is compiles from MS_DLL_ID="$(SysWinVer)", which is equal to "2.7-32" on my system. So, the simplest solution of this bug is to fix installer to store proper key |
I've checked the x86_64 version of python27.dll. |
As far as I know the registry key is a supplament and not a requirement for a correctly functioning python. There is an entire PEP about the registry keys and what to do with them...I'm not sure what the current status is on 2.7, but like I said, I believe that lack of registry keys should not keep python from working if it is installed correctly. Python uses other methods to find its library. Since you are in an embedded scenario, this probably means that there's something about the environment and/or disk layout that you haven't set up in the way that python expects it to be set up. You migth try asking on python-list or the #python irc channel on freenode for help. I'm guessing this means there's something missing from the ebedding docs with respect to Windows, so I'm going to leave this open until that is confirmed or disproven :) |
Could you provide link to that PEP? I understand that python should work without set up of sys.path from the registry, but after start of embedded python instance, sys.path don't have any valid path where 'c:\Python27x64\lib' folder resides. sys.path have ['c:\windows\system32\python27.zip', '.\Dlls', '.\Lib\'] and '.\\' expands to current application directory. |
The output of both x86 and x86_64 python interpreters is attached |
I found the following PEP https://www.python.org/dev/peps/pep-0514/ According to this PEP, starting from python 2.7.11 the backward compatibility was broken, because .dll can't read from the following registry keys anymore: That means, the python27.dll (x86/x86_64) tries to reads '2.7-32' and never see old keys like '2.7' |
The PEP doesn't really apply to 2.7, apart from explicitly expecting tools to still detect 32-bit and 64-bit versions despite sys.winver being the same. As for sys.winver being incorrect in 2.7.11, that's been fixed (bpo-25824), but wasn't deemed critical enough to release 2.7.12 immediately. The next update will be released soon with the fix. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: