4

When I call Python script from shell script, it runs fine.

python script.py

But after I pulled the same script from Gerrit and then added code for calling Python script, then it gave me the below error :

./script.sh: line 126: python: command not found
1
  • Obviously the PATH inside script.sh is different from inside that shell script where it works well. Either fix the PATH in script.sh, or invoke python via the abs-path. Commented Apr 21, 2021 at 6:22

1 Answer 1

3

Looks like path problem.

Use which python in terminal to find your python path first. In my case it's in /usr/bin

$ which python
/usr/bin/python

Then add the python path to path variable in your script.sh, e.g. put the following line in any place before you call python.

PATH+=:/usr/bin
Sign up to request clarification or add additional context in comments.

Comments

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.