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

Will it continue the code after it runs? Or will it stop at that line until the script is executed?

+3
source share
3 answers

Using subprocess.call is the easiest way. It will not return until the executable program terminates. Look at the other methods of the subprocess module if you need different behavior.

+9
source
import os
os.system('./script.sh')

python script will not stop until sh is completed

+4
source

os.system subprocess.Popen subprocess.call, , shell=True. . Python script , .

0

Source: https://habr.com/ru/post/1788436/


All Articles