J'ai un script python qui doit lancer une commande shell pour chaque fichier dans un répertoire:Lancer une commande shell avec un script python, attendez la fin et revenir au script
import os
files = os.listdir(".")
for f in files:
os.execlp("myscript", "myscript", f)
Cette fonctionne bien pour le premier fichier, mais après la fin de la commande "myscript", l'exécution s'arrête et ne revient pas au script python.
Comment puis-je faire? Dois-je fork()
avant calling os.execlp()
?
[ 'returnCode = subprocess.call ([ 'myscript', f])'] (http://stackoverflow.com/a/5184921/4279) – jfs