[python-win32] Passing Args through PythonService.exe
Mark Hammond
skippy.hammond at gmail.com
Mon Jul 1 04:53:17 CEST 2013
On 21/06/2013 6:06 AM, Michael Manfre wrote:
> Is it possible to pass args through PythonService.exe on to the
> ServiceFramework class? The only arg that I ever see come through the
> init is a tuple containing only the _svc_name_. I need to install many
> services for celery workers and having to create a separate class/file
> for each environment and queue combination would be painful.
>
> I started to dig in to PythonService.cpp, but have yet to find any way
> of controlling what argv will used with the init.
pythonservice does set sys.argv (see PyService_InitPython() in
PythonService.cpp) - but note that windows has pretty poor support for
service command-lines in general - eg, setting "arguments" in the
control panel applet doesn't persist those arguments - they are one-shot
(eg, so it's not uncommon for services to manually persist these values
in the registry when they are seen)
So I suspect you simply aren't seeing the service started with the
command-line args you expect...
Mark
More information about the python-win32
mailing list