[python-win32] Re: Windows service features and Python

Mark Hammond mhammond at skippinet.com.au
Mon Aug 9 14:28:08 CEST 2004


> Based on the downloaded source, I created a dll with MSVC, and managed
> to write events with IDs from that dll. However, for custom categories
> I had to create the registry keys by hand, because I found no
> method for
> this in PyWin32.

win32evtlogutil.py may have some helpers you find useful - it can register
new event categories.  win32service* only provide service specific
functions - even though services usually use event logging functions, they
are a discrete set of APIs.

> Now I'm trying to figure out how can I make these IDs visible by
> symbolic name in my Python source, like pipeTestService uses
> servicemanager.pyd. I don't want to define these twice, and
> keep in sync all the time...

Check out "h2py" in the Python "Tools\scripts" directory for one option.

> I found this out only by looking at the source, as its help does
> not mention this switch. It would also be nice if this would
> support pause and continue functions.

I agree.  I'd welcome specific suggestions as to what needs better docs (and
welcome even more the specific text to use <wink>).  The --perfmon switches
were a (possibly poor) attempt at merging services and the permon API, but
although often used by services, just like the event logging functions they
are a different set of APIs

> Thanks for the help so far.
>
> It seems that now I got all the answers, except for one new question:
>
> Q4) I can't make my service interactive. I never get a console
>     window despite that I use the --interactive flag, and I can
>     see it set under the logon tab of service properties. What
>     did I get wrong?

I believe that flag controls the service's access to the win32 "desktop"
(which is not the same as the Windows Explorer deskop).  ie, if your service
is "interactive", then you should see modal dialogs and other windows
displayed by the service.  However, you don't see a console created for the
service itself (in the same way as you don't see a console created for other
services when you set this flag via the standard Windows services GUI)

As I said before, you need to assume your questions are *not* Python related
(until you can show otherwise), rather than the other way around :)

Mark.



More information about the Python-win32 mailing list