1

I am currently trying for a python script written in Flask framework to implement and run as a windows service.

Have tried using different solutions like as below link: http://www.chrisumbel.com/article/windows_services_in_python

But getting same windows error:

D:\>python PySvc.py start
Starting service PySvc
Error starting service: The service did not respond to the start or control 
request in a timely fashion.

Kindly assist me, as i am not able to proceed on this.

Walk
  • 1,531
  • 17
  • 21
  • Did u try this - https://stackoverflow.com/questions/32404/how-do-you-run-a-python-script-as-a-service-in-windows – yogi Aug 21 '18 at 07:14
  • @yogi, Yes, I did tried, Service name is visible in task manager, but after starting it, i am getting the same exception as: `Error starting service: The service did not respond to the start or control request in a timely fashion. ` – Walk Aug 21 '18 at 08:18

1 Answers1

0

Depending on what your requirements are, I think you should have a look at NSSM, it is a great tool to run python scripts as a service on Windows.

You can set up NSSM like this:

nssm.exe install MyPythonScriptService

Then, a dialogbox will pop up: Dialog Box

There are 3 fields that you need to fill in:

Application Path: C:\Python32\python.exe
Startup Directory: C:\Path\To\My\Python\Script\
Arguments: C:\Path\To\My\Python\Script\script.py

And then, hit Install service. Go to services.msc and make sure your service is up and running.

Check out this question as well And this video

Hope It helps you!

marcosmcb
  • 21
  • 3