Skip to content

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

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant