Run python function in shell script -


let's want use shell script run python file, called test.py, in directory called test in home directory. tried following code, not work:

 #!/bin/bash   echo "starting."   module load gcc/4.8.2  module load python/3.4.1   echo "modules loaded."   $home/test/test.py   exit 0 

i not believe how trying run program ($home/test/test.py) works. have not been able determine how this, despite searching long time. appreciated.

this 1 of following, or may combination of both.

the python script not executable. fix with:

chmod u+x $home/test/test.py 

the script not start #! line pointing python. fix making first line of test.py:

#!/usr/bin/env python 

you can use full path instead of using /usr/bin/env use $path resolve name.

#!/usr/local/bin/python 

Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -