Running Python script from bash: Command not found error

22,796

This could work

  1. Insert this #! /usr/bin/Python at the top of gen_par_final.py file.
    (It's usually /usr/bin/python you need to check out how it's capital P)

  2. Make gen_par_final.py executable.
    $ chmod +x gen_par_final.py

  3. Edit your shell script.

    echo -e "Enter the file stem name"
    read filestem
    ./gen_par_final.py 0 $filestem

Share:
22,796
Vignesh
Author by

Vignesh

Updated on July 09, 2022

Comments

  • Vignesh
    Vignesh over 1 year

    I Get command not found error. 0 and $filestem are the two args and I had the following in a script. And when i execute the script, I get command not found.

    echo -e "Enter the file stem name"
    read filestem
    python gen_par_final.py 0 $filestem
    

    The input files, the python script and the bash script are all in the same folder. the python script works at the command promt as such but not inside the script. Is there any path to be set or something that will resolve the problem?