subprocess.Popen([os.path.join(sys.prefix, "python.exe"), strChildScript, strOutputFile])
pid = subprocess.Popen([os.path.join(sys.prefix, "python.exe"), strChildScript, strOutputFile]).pid
from time import localtime from subprocess import Popen result=Popen([r'C:\Python26\python.exe', r'C:\GIS Projects\CRW\FTPhalf.py']).wait() if result == 0: Â Â Â pass else: Â Â Â Popen([r'C:\Python25\python.exe', r'C:\GIS Projects\CRW\GPhalf1.1.py']).wait() Â Â Â Popen([r'C:\Python25\python.exe', r'C:\GIS Projects\TaxChange\taxchange.py']).wait() if localtime()[2] == 1: Â Â Â subprocess.Popen([r'C:\Python25\python.exe', r'C:\GIS Projects\GIS Projects\Parcels.gdb\parcelupdate.py']).wait()
result=subprocess.Popen('([r'C:\Python25\python.exe', your script]').wait() #in the other script, at the end make it do sys.exit(1) if you compelete successfully if result==1:    pass else:    print error info here    sys.exit()
# parent.py import numpy, pickle, os, subprocess, sys colArray = numpy.array([1,2,3]) strOutputFile = os.path.join(os.getenv('TEMP'), "array.pkl") pickle.dump(colArray, open(strOutputFile, 'wb')) print colArray strChildScript = r"C:\Temp\child.py" intReturnCode = subprocess.call([os.path.join(sys.prefix, "python.exe"), strChildScript, strOutputFile]) colNewArray = pickle.load(open(strOutputFile, 'rb')) print colNewArray
# child.py import numpy, pickle, sys strOutputFile = sys.argv[1] colArray = pickle.load(open(strOutputFile, 'rb')) colArray2 = numpy.array([4,5,6]) colArray = numpy.vstack((colArray, colArray2)) pickle.dump(colArray, open(strOutputFile, 'wb'))
You need some sort of serialization model to pass information among processes. They can't just manipulate the same memory. There's a chance James wants multiprocessing, twisted, numpy's serialization stuff, or a few other things.
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.