Skip to content

Textual run not respecting interpreter choice #47

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

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

Conversation

Birnendampf
Copy link

when trying to run a Textual app without activating the envirionment (out of laziness or in scripts) using e.g.

.venv/bin/textual run main.py

it will look up "python" in $PATH instead of using the one in .venv/. This results in it trying to run the app with the system interpreter and thus not being able to import Textual.
the reason for this is this line of code.

os.execvpe(sys.executable, ["python", *args], environment)

Apparently (I didn't know this either) the executable from args is used, not the one given to os.execvpe() , at least on linux, and since that is just "python" it is looked up in $PATH.
Also, there is no need to use execvpe() instead of execve() because sys.executable is always absolute

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