I can get rid of the shell=1 using subprocess.Popen([python.exe,
C:\\Python27\\Scripts\\test.py]). This also works fine using debug
mode. I can kill it via os.kill() or Popen.send_signal().
It also runs fine via net start. But when I stop it via net stop, it
gives me the following error:
Have you tried spawning pythonw.exe instead of python.exe?
http://bugs.python.org/issue3905 might help you.
A bit of googling suggests this is a recurring issue with subprocess and
non-windowed applications.
On Wed, Jun 19, 2013 at 3:20 PM, Patrick Tisdale
patrick.tisd...@gmail.comwrote:
I
Hello list,
I have written a test script to run as a service. The service starts up
properly, and spawns a subprocess (called test.py) using subprocess.Popen.
However, I am having no luck killing the subprocess when I stop the
service. I am using os.kill()
It works fine when running
The other solutions I can think of are likely heavier and harder than
arranging to spawn the child without shell=1 - so I'd suggest tackling that.
Or *maybe* - you could do something like spawning a thread in the child
process to read from stdin - that's likely to block until the cmd.exe