Great question — answering as the UphillTech team:
To run a shell script in python 2.6, use the commands module: import commands status, output = commands.getstatusoutput("./script.sh") status is now the exist status of your program, hopefully 0 . The output the same as if the script were run like this: { cmd ; } 2>&1 In python3, the getstatusoutput method has moved into subprocess, import subprocess status, output = subprocess.getstatusoutput("./script.sh") Please refer to: subprocess commands In the standard library documentation. There are more ways to spawn subprocesses, and you need to assess which one is the correct method in your case. Refer to the subprocess docs to read about them. An even better way to run your script is this:...
Full answer by Stefano Palazzo: https://askubuntu.stackexchange.com/a/18693 (CC BY-SA 2.5).
Need it done for your business? UphillTech.