If I am starting a service (net start abc) from python, how can I make it such the service starts as a child process under python but not as a system process.

More Info:

  1. I am starting a webserver by using net start from python.

  2. I am also opening a browser from python with a command requesting a stream from the web server.

  3. Python executes the net start command but the service starts as a system process.

  4. Is there a switch I can use to start the service under python as a child process, because I have a debugger attached to python and I want to debug the service.

有帮助吗?

解决方案

Launching an established service as a child process of Python won't be possible. A Windows Service is started and controlled by the Windows Service Control Manager and the associated process will be a child of the "services.exe" process.

Perhaps, if your service's underlying executable permits it, you may be able to invoke the executable directly from Python instead of using "net start". But of course then, it won't be running as a service...

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top