New submission from Florian Bruhin:

Trying to call a 32bit Python via subprocess from a 64bit one works as expected:

    Python 3.4.2 (v3.4.2:ab2c023a9432, Oct  6 2014, 22:16:31) [MSC v.1600 64 
bit (AMD64)] on win32
    [...]
    >>> subprocess.check_call([r'C:\Python34_x32\python.exe', '-c', 
'print("Hello World")'])
    Hello World

However, when passing the `env` parameter, even just as `env=os.environ`, 
things break:

    >>> subprocess.check_call([r'C:\Python34_x32\python.exe', '-c', 
'print("Hello World")'], env=os.environ)
    Fatal Python error: Failed to initialize Windows random API (CryptoGen)

Starting a 64bit Python from the 64bit one works fine:

    >>> subprocess.check_call([r'C:\Python34\python.exe', '-c', 'print("Hello 
World")'], env=os.environ)
    Hello World

According to issue20614 the "Fatal Python error" happens when SYSTEMROOT is not 
set, but that's definitely set in the original environment.

Looking at the code, it just passes env to Windows' CreateProcess[1] - I guess 
this does *something* different in this scenario when None/NULL is given as 
compared to the os.environ dict?

This breaks virtualenv with --python for me:

    C:\Users\florian\tmp>C:\Python34\python.exe -m virtualenv 
--python=C:\Python34_x32\python.exe venv3
    Running virtualenv with interpreter C:\Python34_x32\python.exe
    Fatal Python error: Failed to initialize Windows random API (CryptoGen)

[1] 
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx

----------
components: Library (Lib), Windows
messages: 245700
nosy: The Compiler, astrand, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: subprocess with env=os.environ fails with "fatal python error" when 
calling 32-bit python from 64-bit one on Windows
versions: Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24493>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to