1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| from subprocess import Popen, PIPE
from os import waitpid, getcwd
from time import sleep
from os.path import join
print ("Lancement de la commande")
output, errors = Popen([join(getcwd(), "test.sh")], stdout=PIPE, stderr=PIPE).communicate()
print ("Attente")
sleep(2.0)
print ("Sortie")
print output
print ("Erreur")
print errors
print ("Lancement de la commande")
output1, errors1 = Popen([join(getcwd(), "test1.sh")], stdout=PIPE, stderr=PIPE).communicate()
print ("Attente")
sleep(2.0)
print ("Sortie")
print output1
print ("Erreur")
print errors1 |