Repository navigation
Sourcing paths using $.prefix only works on the first invocation
#749
Replies: 1 comment
|
Add a command separator after import { $ } from 'zx';
$.prefix += 'source .venv/bin/activate; ';
console.log((await $`python -c "import sys; print(sys.prefix)"`).stdout.trim());
console.log((await $`python -c "import sys; print(sys.prefix)"`).stdout.trim());With a real Python virtual environment, zx 8.8.4 and Bash, both invocations printed the virtual environment's prefix. Each This example assumes the script's working directory contains |
Uh oh!
There was an error while loading. Please reload this page.
I'm writing a zx script which needs to use a python venv.
I am sourcing the venv using:
No matter if I use it in the root of the document, or in a
withinscope, it keeps failing after the first call to a binary inside the venv path.In the end I decided to use:
The
activateitself is:I know that this might be a bit sparse with the info, but I'd really like to understand what's going on under the hood here.
All reactions