[python-win32] Wanted to know how we can overwrite the win32serviceutil.ServiceFramework SvcDoRun method.

pavi ena potterpavi at gmail.com
Fri Mar 30 15:34:41 CEST 2012


Hello Tim Roberts,

Thanks a lot. I will open up the source code and try to understand the
implementation.
I will continue to work with my existing code.






On Thu, Mar 29, 2012 at 10:37 PM, Tim Roberts <timr at probo.com> wrote:

> pavi ena wrote:
> >
> > I am new to Python Window services development. I have small code below.
> > ...
> > Generally i run this script as batch file which takes parameters like
> > user_id
> > and password
> >
> > python demo_svcs.py install
> > python demo_svcs.py start %user_id% %password%
> >
> > At present in my code i am passing user_id and password as argv
> >  "win32serviceutil.HandleCommandLine(DemoService, argv=sys.argv)"
> >  which intern i am accessing these user_id and password in 'SvcDoRun'
> > method
> >  with 'args', i just wanted to know is this the correct approach or do
> > we have flexibility
> >  to overwrite 'SvcDoRun' method to get these 'user_id' and 'password'
> > as kwd_args
> >  and use these kwd_args in 'start_mail_check' method.
>
> Remember that you have the full source code to win32serviceutil.py in
> your Python distribution.  You can go look it up.  SvcDoRun is called
> from win32serviceutil.py.  You'll see that it is called from
> ServiceFramework.SvcRun with no parameters:
>    self.SvcDoRun()
>
> SvcRun is called in response to a message from the Service Control
> Manager, so there's really no place to make a modification like that.  I
> think you need to keep doing what you are doing.
>
> --
> Tim Roberts, timr at probo.com
> Providenza & Boekelheide, Inc.
>
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20120330/19f39dfb/attachment.html>


More information about the python-win32 mailing list