Skip to content
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

Remove __PYVENV_LAUNCHER__ from the environment for child processes. #62

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dmcooke
Copy link

@dmcooke dmcooke commented Feb 20, 2020

For framework builds of Python on macOS, if PYVENV_LAUNCHER exists,
it's used as the value of sys.executable, and thus is used as the base
for a raft of values, including the system directories in sys.path.
(See: site.py in Python source)

Additionally, python sets this in the environment for subprocesses,
as a way to get around some technical issues with launching scripts
that use the GUI. (See: Mac/Tools/pythonw.c in Python source)

Thus, when vex exec's /bin/python, the python launched
thinks it's actually vex's python, at /opt/local/bin/python
(or whatever), and so adds the non-virtualenv paths to sys.path.

For framework builds of Python on macOS, if __PYVENV_LAUNCHER__ exists,
it's used as the value of sys.executable, and thus is used as the base
for a raft of values, including the system directories in sys.path.
(See: site.py in Python source)

Additionally, python sets this in the environment for subprocesses,
as a way to get around some technical issues with launching scripts
that use the GUI. (See: Mac/Tools/pythonw.c in Python source)

Thus, when vex exec's <virtualenv>/bin/python, the python launched
thinks it's actually vex's python, at /opt/local/bin/python
(or whatever), and so adds the non-virtualenv paths to sys.path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant