I'm having trouble loading processes from a python application.
Before I was using subprocess.Popen but it creates subprocesses of the main application and in my case, I need to create processes that run independently, in the sense that, if my application falls, the processes do not fall.
Another need is to retrieve the process PID (for this reason I am not using os.system ()).
I tested os.spawnl () but did not succeed. Anyone have any suggestions?
Follow the code where I tested os.spawnl ()
>>> import os
>>> programa = r'C:\Program Files (x86)\mongoDB\bin\mongod.exe'
>>> parametros = r'--logpath "C:\Foo\Bar\Base\install.log" --dbpath "C:\Foo\Bar\Base\data\db" --port 1124'
>>> os.path.dirname(programa)
'C:\Program Files (x86)\mongoDB\bin'
>>> os.path.basename(programa)
'mongod.exe'
>>> os.spawnl(os.P_WAIT, os.path.dirname(programa), os.path.basename(programa), parametros)
Traceback (most recent call last):
File "<pyshell#20>", line 1, in <module>
os.spawnl(os.P_WAIT, os.path.dirname(programa), os.path.basename(programa), parametros)
File "C:\Python33\lib\os.py", line 922, in spawnl
return spawnv(mode, file, args)
>>> os.spawnl(os.P_WAIT, "%s %s".format(programa, parametros))
#aqui ocorre crash no pythonw