Running Python and Shell scripts in Terminal, and passing arguments
In the Python script
import sys
var1= eval(sys.argv[1])
assert isinstance(var1, int)
var2= eval(sys.argv[2])
assert isinstance(var2, bool)
myfunc(var1,var2)In the shell script
cd file_path_I_need
conda deactivate
conda activate <myenv>
#just to see which is which
echo "the file name: $0"
echo "first argument: $1"
echo "second argument: $2"
python3 path_to_python_script.py $1 $2What to run in iTerm
Last updated