How to run python script in linux Executable shell

1.4k Views Asked by At

I Have a python script ready and I need to run using Hudson CI. I can see configure job having the only environment supported is an executable shell. How can I run a python script in the executable shell (Bash shell)? any idea or suggestions?

2

There are 2 best solutions below

0
Pari On

python3

python3 file.py

python2

python file.py
0
planetmaker On

Aside from the obvious python3 file.py or python file.py, it is possible to make the python file executable on its own by introducing an appropriate shebang at the top:

#!/usr/bin/env python3
...
(script follows here)

or

#!/usr/bin/env python
...
(script follows here)

Using these, your CI doesn't need to know that the script is written in python, in shell, in perl or whatever language it uses.