py2exe and dynamic service installation ?

mmillikan at vfa.com mmillikan at vfa.com
Mon Jun 23 09:35:38 EDT 2003


"Harald Schneider" <h_schneider at marketmix.com> writes:

> Hi,
> 
> I used py2exe to create a NT service, which works flawlessly. Now the same
> application needs to be installed multiple times on the same machine. For
> this I need to pass _svc_name_ and _svc_display_name_ at runtime as command
> line parameters after -install.
> 
> But no matter what I do, if I compile the application with py2exe it falls
> back to the first assignment of _svc_name_ in the class header - it just
> ignores the passed command line paramters and also any assignment to
> _svc_name_ etc in the class header or the __init part ...
> 
> Is there a way to assign these varibales dynamically before the service is
> created ?
> 
> All the best,
> Harald

The attached diff to py2exe v.0.3.4 run_svc.c adds the following optional
command line args to the users exe file:

-service <desired name>
-display <display name>
-depends <pipe|separated|dependencies>
-user    <account name>
-pass    <password>
-auto    no param, sets service to autostart

Rebuild the py2exe interpreters by running 'python setup.py build' in
the py2exe directory.

This is only lightly tested and not yet used in production.

I also have a run_svc_w.c which provides a consoleless analog to
run_w.c (usefull for avoiding 'flashing window syndrome' when bundling
exe's for use within an installer such as NSIS or Inno Setup).

Feedback welcome.

Mark Millikan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: svc.c.diff
Type: text/x-patch
Size: 6298 bytes
Desc: diff against run_svc.c
URL: <http://mail.python.org/pipermail/python-list/attachments/20030623/ab816482/attachment.bin>


More information about the Python-list mailing list