Hello NG,
I don't know if this is the right place to post this question, but
noting that it is os-related probably someone will have some nice idea.
I have built an application using Python+wxPython, and I have compiled it
into an exe file using py2exe. In my app, I use a call:
self.process = os.spawnl(os.P_NOWAIT, MyCommand)
where MyCommand is a call to an external exe file. When I run my
application (without the DOS window), a new DOS window is created for every
call to os.spawnl. This is something I would like to avoid because I don't
need to have 50 DOS windows opened on my PC. Moreover, I need to keep a
reference to self.process, because I woule like to be able to kill the
process when the user decides to kill it. In order to kill it, I use a
command like:
if self.process is not None:
if wx.Platform == '__WXGTK__':
try:
status = os.kill(self.process, 9)
except:
pass
else:
try:
win32api.TerminateProcess(self.process,0)
except:
pass
status = 0
self.process = None
I thought I could use os.popen* things, but it seems to me that they do not
return something that could be killed using os.kill() or
win32api.TerminateProcess().
Am I missing something about the os things? Does anyone have a better
solution?
Thanks to you all.
Andrea.
------------------------------------------------------------------------------------------------------------------------------------------
Message for the recipient only, if received in error, please notify the
sender and read http://www.eni.it/disclaimer/