Inside python code, how do I run a .sh script?


Question

Will it continue the code after it's run? Or will it stop at that line until the script is done?

1
4
1/28/2011 9:36:22 AM

Accepted Answer

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

10
1/28/2011 9:37:41 AM

import os
os.system('./script.sh')

python script won't stop until sh is finished


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon