[python-win32] Failure to import zlib in Windows services
t-meyer at ihug.co.nz
Thu Nov 11 02:15:23 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:
> I suspect you have a zlib.dll in your system32 directory -
> this is often the CWD when run as a service.
I knew posting a message asking for help would be quicker than trying to
figure it out myself (although I had begun to suspect something like that)
> I really should fix the service implementation to handle this
> common error.
Is it that common? I googled about trying to find a solution, and couldn't
find much. But yes, fixing would be good :) Want me to open a bug tracker?
> A quick hack would be something like:
> if sys.path=="":
> sys.path = os.path.dirname(__file__)
> (or something like that :)
My problem was actually that the system32 directory was before the
PythonXX\DLLs directory (i.e. the CWD didn't come into it). So I ran
through sys.path and bumped that to the end if it was there. Hackish, but
should do for now, anyway.
Thanks for the (quick!) help :)
More information about the Python-win32