Run shell script in python

Make sure that sleep.sh has execution permissions, and run it :

#!/usr/bin/pythonimport subprocessprint ("start")subprocess.call("./sleep.sh")print ("end")

If someone looking for calling a script with arguments

import subprocessval = subprocess.check_call("./script.sh '%s'" % arg,   shell=True)

remember to convert the args to string before passing, using str(arg).

This can be used to pass as many arguments as required

subprocess.check_call("./script.ksh %s %s %s" % (agr1, str(arg2), arg3),   shell=True)