[ACCEPTED]-Inside python code, how do I run a .sh script?-shell

Accepted answer
Score: 10

Using subprocess.call is the easiest way. It will not return 3 until the executed program has terminated. Have 2 a look at the other methods of the subprocess module if you 1 need different behaviour.

Score: 8
import os
os.system('./script.sh')

python script won't stop until sh is finished

0

Score: 1

You can use os.system or subprocess.Popen or subprocess.call but when using subprocess 4 methods make sure you use shell=True. And executing 3 it via system call in all these methods 2 is blocking. The python script will complete 1 and then go the next step.

More Related questions