Deepak Sakpal wrote:
> This is the script that i want to convert into windows service:
> # Make 'cwd'/src in the PYTHONPATH
> import sys, os, os.path
> PATH = os.path.abspath(os.path.dirname(sys.argv))
> PATH = os.path.join(PATH, "src")
> sys.path = PATH
> # Start the service
> import main
> I looked into advanced samples that comes with python. I also created the
> windows service but it is not working. There are two files in advance
> samples - MyService.py, setup.py. Where should I insert the above code into
> Please help me with this.
> Deepak Sakpal (deepak@...)
> All the advantages of Linux Managed Hosting--Without the Cost and Risk!
> Fully trained technicians. The highest number of Red Hat certifications in
> the hosting industry. Fanatical Support. Click to learn more
Just for the record: You can't just turn a Python script into a Windows
Service. It must be written that way.
The service itself is, of course, written as a class based on
win32serviceutil.ServiceFramework base class.
If you are writing Windows Services, you should pick up a copy
of Mark Hammond's-Python Programming on Wind32 (if you haven't
If you already knew that, please accept my apologies.
Here is the setup.py script from one of my services called SmartRoute:
from distutils.core import setup
Here is SmartRoute's main program:
# Following line handles install/remove/start/stop commands from the
# command line when this installed as a PythonService.