How to build a Windows service using win32?

Gregor Mosheh gregor at
Wed Mar 7 17:45:44 CET 2007

Giles Brown wrote:
> Yeah.  You've cleverly decided to simplify the "smallest
> possible python service" by removing the
> if __name__ == '__main__':

Ha ha. :)
Seriously, though, I removed that long after it was failing to work, and
have since replaced it and it didn't affect a thing.

Gabriel Genellina wrote:
> Have you installed the pywin32 package from
> ?
> The code skeleton looks OK to me.

Indeed, I have win32 installed. :)

I'm used to writing wxPython apps, even a small-scale video game, but
services are a new and alien direction for me. :)

Now, I did stumble upon the solution to this one this morning, after a
fresh night of sleep: I re-ran "python install" I got a message
that the service had been updated, and now it runs! Hooray!

Any insight into why that would be the case? Does pythonservice.exe keep a
cached copy or some such, so I'll have to re-install the service after
code changes?

More information about the Python-list mailing list