I spend a bunch of time to understand why one of my python command (`west`) 
didn't work as expected. Finally, I found it was because I installed my package 
in a `venv` and `west` it executed commands provided by required packages. eg:

    import subprocess
    subprocess.run(["command-provided-by-a-required-package"])

So, the snippet below worked:

    $ source /home/jerome/.local/pipx/venvs/west/bin/activate
    (west) $ west
    ... <work as expected> ...

This one also worked:

    $ export PATH=$PATH:/home/jerome/.local/pipx/venvs/west/bin
    $ west
    ... <work as expected> ...

But running `west` without changing the `$PATH` didn't work:

    $ west
    ... <does not work as expected> ...

(note since I have no luck, the error message was unrelated to `$PATH`)

I thought that running a binary from a `venv` had exactly the same behavior 
than activating the `venv` and then running the binary. The documentation seems 
to say the same. Do you think this behavior is a bug or is expected? If it is 
expected, what change should I suggest to `west` to properly run with `venv`?





---
[Visit 
Topic](https://discuss.python.org/t/venv-activate-script-changes-path-while-executing-the-binary-doesnt/67580/1)
 or reply to this email to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click 
here](https://discuss.python.org/email/unsubscribe/4ab79d6dc03448ad9d8a4eb449589328c2341222c2431963200d0321645cf726).

Reply via email to