Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to use python to register a service (an existing .exe file)

7 views
Skip to first unread message

News123

unread,
Feb 15, 2010, 7:10:51 PM2/15/10
to
Hi,

Is there a python way to register new windows services.


I am aware of the
instsrv.exe program, which can be used to install services.
I could use subprocess.Popen to call


instsrv.exe "service_name" program.exe


but wondered, whether there's already an existing function.

Thans in advance and bye


N

Aahz

unread,
Feb 19, 2010, 7:15:07 PM2/19/10
to
In article <4b79e28c$0$4610$426a...@news.free.fr>,
News123 <new...@free.fr> wrote:

Use the win32 package.
--
Aahz (aa...@pythoncraft.com) <*> http://www.pythoncraft.com/

"At Resolver we've found it useful to short-circuit any doubt and just
refer to comments in code as 'lies'. :-)"

Chris Withers

unread,
Mar 1, 2010, 4:38:13 AM3/1/10
to Aahz, pytho...@python.org
Aahz wrote:
> In article <4b79e28c$0$4610$426a...@news.free.fr>,
> News123 <new...@free.fr> wrote:
>
>> Is there a python way to register new windows services.
>>
>> I am aware of the
>> instsrv.exe program, which can be used to install services.
>> I could use subprocess.Popen to call
>>
>> instsrv.exe "service_name" program.exe
>>
>> but wondered, whether there's already an existing function.
>
> Use the win32 package.

Indeed, there's some intersting code in this area here:

http://svn.zope.org/Zope/trunk/src/nt_svcutils/service.py?rev=104819&view=auto

http://svn.zope.org/Zope/trunk/src/Zope2/Startup/zopectl.py?rev=105396&view=auto

...particularly in the do_install function in the latter...

Chris


--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk

Eman

unread,
Mar 1, 2010, 8:47:44 PM3/1/10
to


Try my favorite 3rd pary tools maker, Chilkatsoft.com.
http://www.chilkatsoft.com/refdoc/pythonCkServiceRef.html

Eman_No1

coldpizza

unread,
Mar 2, 2010, 8:12:37 AM3/2/10
to
instsrv.exe does not come with Windows by default, but I guess it
should be possible to add a service using the win32 built-in `sc`
command line tool.

Try `sc create` from a console.

The app you want to install as a service will still have to be
compliant with the win32 service interface, otherwise it will throw an
error, although the app will still be started.

0 new messages