[issue22490] Using realpath for __PYVENV_LAUNCHER__ makes Homebrew installs fragile
Tim Smith
report at bugs.python.org
Thu Dec 22 15:00:38 EST 2016
Tim Smith added the comment:
I spoke prematurely; I recently rediscovered that the persistence of __PYVENV_LAUNCHER__ poisons the sys.executable of virtualenv interpreters launched as a subprocess of another Python interpreter:
$ virtualenv -p python3 test
$ test/bin/python3 -c 'import sys; print(sys.executable)'
/Users/tim/test/bin/python3
$ /usr/local/bin/python3 -c 'import subprocess; subprocess.call(["/Users/tim/test/bin/python3", "-c", "import sys; print(sys.executable)"])'
/usr/local/bin/python3
$ /usr/local/bin/python3 -c 'import subprocess, os; del os.environ["__PYVENV_LAUNCHER__"]; subprocess.call(["/Users/tim/test/bin/python3", "-c", "import sys; print(sys.executable)"])'
/Users/tim/test/bin/python3
If __PYVENV_LAUNCHER__ can be unset before script execution begins, that seems ideal.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22490>
_______________________________________
More information about the Python-bugs-list
mailing list