I am a newbie in Python. I recently tried to use Python script to call an console exe which is a process need long time. I will allow the exe being called as many times as the CPU can permit. And when the exe has finish its job. The CPU can be allocated to other new jobs. So I think I may need the multiple process control mechanism.
Before I switch to multiprocessing.Process I can call my exe from subprocess.Popen. It works fine. However, after I switched to multiprocessing.Process. It seems start() can not call my exe (I can tell the difference from CPU performance). Can anyone give a clue on this? FYI, I am using the following code.
previously using subrpocess:
cmd = exeFileName + r" " + inputArguments
a = subprocess.Popen(cmd, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
Now using multipleprocess:
b = multiprocessing.Process(target=exeFileName,args=inputArguments)
b.start()
As you may noticed, my exe need input arguments to work. So in the subprocess code, I use a string of cmd to capture the whole line. In multiprocessing code, I am not. It already has a target and args built-in. Thank you for your time!