Eryk Sun <eryk...@gmail.com> added the comment:

> This scenario should work, as running the other venv's redirector 
> will update the variable.

The order gets reversed. In the simple case where we have two launchers, the 
launcher for the nested virtual environment executes the launcher for the outer 
(creator) virtual environment, which executes the real python.exe. So Python 
sees the wrong value for __PYVENV_LAUNCHER__. For example, if I create env37_2 
from env37_1, here's the result in env37_2:

    C:\>C:\Temp\test\env37_2\scripts\python.exe
    Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28)
    [MSC v.1916 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import sys, os
    >>> print(sys.executable)
    C:\Temp\Test\env37_1\scripts\python.exe

    >>> print(*sys.path, sep='\n')

    C:\Program Files\Python37\python37.zip
    C:\Program Files\Python37\DLLs
    C:\Program Files\Python37\lib
    C:\Program Files\Python37
    C:\Temp\Test\env37_1
    C:\Temp\Test\env37_1\lib\site-packages

    >>> print(os.environ['__PYVENV_LAUNCHER__'])
    C:\Temp\Test\env37_1\scripts\python.exe

----------

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

Reply via email to