0

I have a bash script which setups the environment for the application. At the last line of the bash script I call Python:

app_start.sh

exec $PROGRAM_NAME "$@"

where $PROGRAM_NAME is the path to Python, e.g. /usr/bin/python, so this is how I run Python:

./app_start.sh /usr/bin/python

Now, I need this path as program name, i.e. in sys.argv[0] but when I try to get sys.argv, it is empty. Only when I pass a Python script as argument, I can get that script name in sys.argv:

./app_start.sh /usr/bin/python /path/to/script.py

and sys.argv = ['/path/to/script.py'].

My question is, how can I retrieve ALL arguments, i.e. starting with Python path, from sys.argv? I need sys.argv[0] to be /usr/bin/python.

Thanks in advance.

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.