Win2000 service and pywintypes.api_error

Cesare Zamatti nospam at nospam.it
Tue Dec 17 03:47:51 EST 2002


Thank you Mark,

maybe I found a trick.
If I run that simple service  on a winXP  all it's working good (no errors
in the eventViewer)
and if I run that simple service on a Win2000 to avoid the error in the
eventViewer
I have to comment  out the last line in SvcDoRun:

 self.ReportServiceStatus(win32service.SERVICE_STOPPED)

Just remove that line and the service it's working good on a 2000 too.
I noticed that looking at edna (mp3 streaming) service for NT as an example.

Right now, I' m far to understand the reason why,
but I hope this may help someone else.

Bye


"Mark Hammond" <mhammond at skippinet.com.au> wrote in message
news:qe8L9.7066$y17.19361 at news-server.bigpond.net.au...
> Cesare Zamatti wrote:
> > Hey all,
> >
> > I 've written an  NTservice for a Win2000 Server using
> > win32serviceutil.ServiceFramework
> > with  python 2.2.2 (from python.org)  and win32all-148 (from
> > starship.python.net)
> > I 've written it with some samples found on the net.
> > The service starts and stops without problems, but if I look at the
> > eventViewer, when I stop the service, it reports this error (in the
> > application log):
> >
> > PythonService:
> > The instance's SvcRun() method failed File "E:\Python22\lib\site-
> > packages\win32\lib\win32serviceutil.py",
> >  line 639, in SvcRun
> > self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
> > File "E:\Python22\lib\site-packages\win32\lib\win32serviceutil.py",
> > line 610, in ReportServiceStatus win32service.SetServiceStatus(
self.ssh,
> > status)
> > pywintypes.api_error: (6, 'SetServiceStatus', 'The handle is invalid.')
>
> I am afraid I have no idea.  I assume that the sample service does not
> do this for you - so you probably are left with continuing to cull your
> service down to almost nothing to see when the error goes away - or
> building the other sample up until it starts.  I know lots of people are
> using very complicated services with this framework, so I believe it is
> nothing fundamental to the framework.
>
> Mark.
>





More information about the Python-list mailing list