Differences between revisions 1 and 2
Revision 1 as of 2005-07-19 13:22:58
Size: 1354
Editor: cache2-2-ffm-vpn
Comment:
Revision 2 as of 2008-07-08 11:27:44
Size: 1356
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 24: Line 24:
[http://groups.google.de/group/comp.lang.python/msg/ac7251f99cd83214?hl=de& a Mail of Gerald Haering] showed me the light: [[http://groups.google.de/group/comp.lang.python/msg/ac7251f99cd83214?hl=de&|a Mail of Gerald Haering]] showed me the light:

Things that can go wrong with py2exe and services

within demos/advanced there is an example to create windows services with py2exe. It works quite out of the box.

Difficulties arise later on - as soon as you wanna do something REAL with that service.

Error Message

Python could not import the service's module 
  File "C:\ham\jds\syncservice.py", line 21, in ?
    import transinhalte
  File "C:\ham\jds\transinhalte.py", line 17, in ?
    import unite
  File "C:\ham\jds\unite.py", line 9, in ?
    import version 
exceptions.ImportError: dynamic module does not define init function (initversion)

yours might be different ... what went wrong????

Everything worked fine as long as I was running that service within debug mode. Then, starting it up as "real service", this error appeared.

a Mail of Gerald Haering showed me the light: when a service is started, all paths are TOTALLY DIFFERENT ANIMALS then in any other running state of python... so, the service tried to load version.dll, which is something that comes within windows/system32, and of course has NO Python init-code.

Solution

Make sure that NONE of your Python module names conflicts with ANY of the windows system dll names

py2exeAndWindowsServices (last edited 2015-12-07 09:41:17 by TijnGommans)