Due to a complex corporate setup and having a venv I use in the CI pipelines and in the target deployment, I need the python inside my venv bin to run whatever python is in the PATH. I do the following but seems to end in an infinite loop:
This is the content of my $DEPLOYMENT_VENV/bin/python
#!bin/bash
python $@
the default actual python to use is setup in the PATH before.
Why would this lead to infinite loop or hanging forever?
$DEPLOYMENT_VENVthe name of a virtual environment? You should not muck with the files inside the virtual environment at all. If it is correctly set up,$DEPLOYMENT_VENV/bin/pythonwill be a wrapper or symlink which runs the correct Python version for this virtual environment. Individual Python scripts should be executable and have#!/usr/bin/env python3or possibly#!/usr/bin/env pythonin their shebang line or just be run withpython scriptname.py$@is wrong; you want to quote it"$@".$DEPLOYMENT_VENV/bin/pythoni.e. without having to change it in each different environment it runs. Then shift the problem of finding the right python to the environment variables or initialization before using the venv.