Bonjour à tous,
Voilà, j'aimerais pouvoir lancer un script à partir d'un autre... Comment dois-je faire ?
ne marche pas...Code:
1
2 pid = os.spawnlp(os.P_WAIT, "monscript.py", "C:/Python2.4//python.exe")
Version imprimable
Bonjour à tous,
Voilà, j'aimerais pouvoir lancer un script à partir d'un autre... Comment dois-je faire ?
ne marche pas...Code:
1
2 pid = os.spawnlp(os.P_WAIT, "monscript.py", "C:/Python2.4//python.exe")
Pour avoir le chemin de l'executable python il existe une constante :
Code:
1
2
3
4 >>> import sys >>> sys.executable 'D:\\PROGRAMMES\\Python\\pythonw.exe'
Comme je vois que tu as l'air de tourner sous windows, saches que spawnlp n'est pas valable sous Windows.
La doc est ton amie:
Par contre ca ca marche:Citation:
Availability: UNIX, Windows. spawnlp(), spawnlpe(), spawnvp() and spawnvpe() are not
available on Windows. New in version 1.6.
=> http://python.developpez.com/faq/?pa...GenExecuteFileCode:
1
2
3
4 import sys import os os.system(sys.executable + ' monScript.py')
mais avec un exec ca doit surement etre plus propre.