![]() I have included a basic description of what you would need to do for that, but let me know if you need more info. They seem a bit more robust than Subprocess (I think subprocess is actually designed for running other programs from Python, not other Pythons), and have the advantage that you can easily pass arguments (paths, buffer sizes, etc.) to them. You can also look at multiprocessing as well.ĭo you need to use subprocess? Perhaps you should look into writing Python modules, which you can import and then run. I didn't test the code, but it will give you a general idea on how this works. # then you have to check if the process completed PList.append(spawn_function(ALL THE VARIABLES)) ![]() ![]() ![]() PythonExe = os.path.join(sys.exec_prefix,'python.exe') ProcessCount = (int(os.environ) - 1) # to account for main thread In the _main_ you call the subprocessing in a loop of some other fashion based on some requirement like number of CPUs. Now you have a function that will return an instance of your subprocess. ScratchWrksp, # scratch workspace 2nd variable in script, etc. InFC,# source feature class 1st variable in script WorkerScript, # script that does the work (path to. You can write all your functions in a simple python script to do what your doing.īut if you want to use subprocessing, here is how you can use it:ĭef spawn_function(pythonExe, # exe of python
0 Comments
Leave a Reply. |