Hello,
I wrote a small program that uses xmlrpc over https. It should work as a
win32 application and as a win32 service too. There is a file called
Processor.py that contains the main thread of the program. It is called
from two files: win32_Applicati on.py and win32_Service.p y. The
application works perfectly. The service does not. I can start it from
the services mmc console, but it does not created logfiles, and does
nothing. It cannot be stopped and I have to kill pythonservice.e xe. The
event log shows this:
Information: The AmazonOfferDown loaderService service has started.
Application error: Faulty application: python.exe, version: 0.0.0.0,
faulty modul: _ssl.pyd, version: 0.0.0.0, memory address: 0x00019b87.
Is it possible that my _ssl.pyd is faulty? Please help me.
Python version: 2.4.3 (#69, Mar 29 2006)
Windows version: Windows XP Professional, service pack 2, Hungarian (I
translated the above messages from the event log....)
Thanks,
Laszlo
>>Here is the code for the application:
from Processor import *
from servicelog import *
from win32_Config import *
stopped = threading.Event ()
stopped.clear()
processor = Processor(stopp ed)
thread.start_ne w_thread(proces sor.Process,())
logger = getLogger('win3 2_Application')
logger.info("St aring as application. Please press CTRL+C to stop service.")
while 1:
try:
time.sleep(1)
except:
break
logger.info("St opping application " + SERVICE_NAME)
stopped.set()
while not processor.stopp ed.isSet():
logger.debug("W aiting for the processor to finish...")
time.sleep(1)
logger.info("Ap plication stopped.")
>>Here is the code for the service:
from Processor import *
from servicelog import *
import win32serviceuti l, win32service
import pywintypes, win32con, winerror
from win32event import *
from win32file import *
from win32pipe import *
from win32api import *
from ntsecuritycon import *
import traceback
import thread,threadin g
class Service(win32se rviceutil.Servi ceFramework):
_svc_name_ = SERVICE_NAME
_svc_display_na me_ = SERVICE_DISPLAY
def __init__(self, args):
win32serviceuti l.ServiceFramew ork.__init__(se lf, args)
self.stopped = threading.Event ()
self.stopped.cl ear()
self.logger = getLogger(SERVI CE_NAME)
def SvcStop(self):
self.logger.inf o("Got SvcStop, trying to stop service...")
self.ReportServ iceStatus(win32 service.SERVICE _STOP_PENDING)
self.stopped.se t()
def SvcDoRun(self):
"""Write an event log record - in debug mode we will also see
this message printed."""
try:
import servicemanager
servicemanager. LogMsg(
servicemanager. EVENTLOG_INFORM ATION_TYPE,
servicemanager. PYS_SERVICE_STA RTED,
(self._svc_name _, '')
)
self.logger.inf o("Started.")
self.logger.deb ug("Creating processor instance")
processor = Processor(self. stopped)
self.logger.deb ug("Starting processor thread")
thread.start_ne w_thread(proces sor.Process,())
self.logger.deb ug("Waiting for the processor thread to finish")
self.stopped.wa it()
self.logger.deb ug("Stopping")
time.sleep(1)
while not processor.stopp ed.isSet():
self.ReportServ iceStatus(win32 service.SERVICE _STOP_PENDING, 5000)
time.sleep(5)
servicemanager. LogMsg(
servicemanager. EVENTLOG_INFORM ATION_TYPE,
servicemanager. PYS_SERVICE_STO PPED,
(self._svc_name _, "")
)
self.logger.inf o("Stopped")
except:
self.logger.err or('',exc_info = sys.exc_info())
if __name__=='__ma in__':
win32serviceuti l.HandleCommand Line(Service)
Comment