script->service.exe

Pieter Claerhout mailinglists at yellowduck.be
Thu Feb 27 12:06:43 EST 2003


Did you register the class defining the service with the event log? I have
written some services and distributed them with py2exe, and this without
problems. The first few lines for the SvcDoRun method of my service class
look like:

        # Register ourselves with the event log
        win32evtlogutil.AddSourceToRegistry(
            self._svc_name_, os.path.join(self.workdir, self._svc_name_ +
'.exe')
        )

The AddSourceToRegistry function takes two arguments:
1. The name of the service
2. The executable used to run the service

That should do the trick...

Cheers,


Pieter

-----Oorspronkelijk bericht-----
Van: python-list-admin at python.org
[mailto:python-list-admin at python.org]Namens Mark Hammond
Verzonden: Thursday, February 27, 2003 07:41
Aan: python-list at python.org
Onderwerp: Re: script->service.exe


Tomas Brixi wrote:
> Hello,
>
> I have a question regarding script implementing a windows service
converted into .exe.
> When I install the script a using pyservice.exe and log something the
event viewer displays
> correctly
> the messages I want to log. I know module service util is build into
pyservice.exe
>
> But when I convert the script using py2exe I get all logs displayed in
event viewer like this one:
> ---------------
> The description for Event ID ( 4098 ) in Source ( myservice ) cannot be
found. The local computer
> may not have the necessary registry information or message DLL files to
display messages from a
> remote computer.....
> ---------------
> Maybe I have forgot to include something. Can anyone help me?

You will probably need to register your own eventlog source, nominating
a file with embedded messages.  This will generally be win32service.pyd
(there is no win32service.py, so it shouldn't be included!)  See
win32evtlogutil.py

I'm not familiar enough with py2exe to know what it does with services,
but generally pythonservice.exe itself takes care of this.  If py2exe is
not using the code in pythonservice.exe, you will have to arrange it
yourself.

--
http://mail.python.org/mailman/listinfo/python-list







More information about the Python-list mailing list