[python-win32] Failure to import zlib in Windows services

Tony Meyer t-meyer at ihug.co.nz
Thu Nov 11 01:12:36 CET 2004


I can't import zlib from a script running as a Windows service.  If I do,
this entry appears in the event log:

"""
Python could not import the service's module 
[...]
  File "C:\Python24\Lib\gzip.py", line 9, in ?
    import zlib 
exceptions.ImportError: dynamic module does not define init function
(initzlib) """

This occurs with Python 2.2.3, 2.3.4 and 2.4b1.  If I import zlib from a
regular script or from the interactive prompt, it works fine.

To demonstrate (unless it's just me...) if you add "import zlib" to the
pipeTestService.py script it installs (and removes) fine, but if you do "net
start PyPipeTestService" that above errors appears in the log.  However (and
this just confuses me more) if you do "pipeTestService.py debug", it starts
up fine.

Any clues?  This is Windows XP SP2, if that matters.  I haven't tried it
elsewhere, but could try Win2k if it's likely to be relevant.

Thanks!

=Tony.Meyer



More information about the Python-win32 mailing list