|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
need help in win service (code) ....
i have worte some code in py which wish to serve as window service....
here is the code: #testservice.py import win32serviceutil import win32service import win32event import os import print_time class testservice(win32serviceutil.ServiceFramework): _svc_name_ = "service" _svc_display_name_ = "Pythonservice" def __init__(self,args): self.hWaitStop = win32event.CreateEvent(None, 0, 0, None) def svcStop(self): self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) win32event.SetEvent(self.hWaitStop) def svcDoRun(self): while not self.events.empty(): os.system("print_time.exe") time.sleep(2) win32event.WaitForSingleObject(self.hWaitStop, win32event.INFINITE) if __name__=='__main__': win32serviceutil.HandleCommandLine(FDFservice) --------------------------------------------------- #setup.py from distutils.core import setup import py2exe import sys sys.argv.append("py2exe") setup(console=[{"script":'testservice.py'}]) --------------------------------------------------- after i installed it & start it, i found that it not "actually" started when i key in "testservice.py stop" in command prompt i dont know which part i been done it wrong & i had look for many resources, but i cant find the answer.. i'm using win xp + pythonwin 2.3 so, may you all guys help me?? ps: the "print_time.exe" is just a simple script to print current date & time in a txt file. it have been tested & can run correctlly.. thanks ah new Last edited by ah new : November 19th, 2004 at 03:32 AM. Reason: missing info |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > need help in win service (code) .... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|