[Python-Dev] is this a bug? no environment variables (original) (raw)

"Martin v. Löwis" martin at v.loewis.de
Tue Nov 23 12:55:38 CET 2010


Am 23.11.2010 11:55, schrieb Amaury Forgeot d'Arc:

Hi,

2010/11/23 Glenn Linderman <v+python at g.nevcal.com>: File "C:\Python32\lib\random.py", line 108, in seed a = int.frombytes(urandom(32), 'big') WindowsError: [Error -2146893818] Invalid Signature In the subprocess documentation http://docs.python.org/library/subprocess.html """On Windows, in order to run a side-by-side assembly the specified env must include a valid SystemRoot."""

Indeed, setting SystemRoot might solve this problem. According to

http://jpassing.com/2009/12/28/the-hidden-danger-of-forgetting-to-specify-systemroot-in-a-custom-environment-block/

CrypoAPI, in Windows 7, requires this variable be set. Failure to find the enhanced crypto provider would explain why the "random" module of Python fails to work.

The specific cause is in the registry: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Cryptography\Defaults\Provider\Microsoft Strong Cryptographic Provider has as it's ImagePath value

%SystemRoot%\system32\rsaenh.dll

So the registry (and COM) do rely on environment variables.

Regards, Martin



More information about the Python-Dev mailing list