[Py] [Python Help] Venv: `activate` script changes `$PATH` while executing the binary doesn't

2024-10-11 Thread Clint Hepner via Discussions on Python.org
Still, it boils down to: whatever command `west` executes is either not found outside your virtual environment, or a different version exists outside it. Path lookup is not exclusive to the shell; `subprocess.run` *also* uses path lookup to find `command-provided-by-a-required-package`. -

[Py] [Python Help] Venv: `activate` script changes `$PATH` while executing the binary doesn't

2024-10-11 Thread Clint Hepner via Discussions on Python.org
[quote="Jérôme Pouiller, post:5, topic:67580, full:true, username:jerome-pouiller"] But, the [documentation says](https://docs.python.org/3/library/venv.html#how-venvs-work): > Furthermore, all scripts installed in the environment should be runnable > without activating it. My understanding

[Py] [Python Help] Venv: `activate` script changes `$PATH` while executing the binary doesn't

2024-10-11 Thread Clint Hepner via Discussions on Python.org
No, the idea is that you write the Python code with enough information to *identify* the external binary, given a suitable execution environment. Ideally, you are going to execute the command by name alone, not an absolute or relative path, and configure the (virtual) environment so that the c

[Py] [Python Help] Venv: `activate` script changes `$PATH` while executing the binary doesn't

2024-10-11 Thread Clint Hepner via Discussions on Python.org
Your first two examples are equivalent; activating the virtual environment is done primarily to modify `PATH` in exactly the way you do so manually in your second example. What happens when you (try to) execute `west` without modifying your `PATH` variable depends on whether a command named `