Passing arguments to a python service

Posted by Grim on Stack Overflow See other posts from Stack Overflow or by Grim
Published on 2010-06-08T19:15:21Z Indexed on 2010/06/08 23:02 UTC
Read the original article Hit count: 170

Filed under:
|

Hi, I need some help with a python service.

I have a service written in Python. What I need to do is to pass it some arguments. Let me give you an example to explain it a bit better.

Lets say I have a service, that does nothing but writes something to a log. I'd like to write the same thing into the log several times, so I use a loop. I would like to pass the counter for the loop when I start the service, but I have no idea how. I start the service with:

win32serviceutil.HandleCommandLine(WinService)

I'm looking for something like

win32serviceutil.HandleCommandLine(WinService,10)

I don't really care how its done, as long as I can pass arguments to it. Have been trying to get this to work for the better part of the day with no luck. Also, the service isn't run directly, but is imported and then run from there.

© Stack Overflow or respective owner

Related posts about python

Related posts about Services