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

Mark Hammond mhammond at skippinet.com.au
Thu Nov 11 03:21:56 CET 2004


> > 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.

It has come up with 'wmi' a few times.

> But yes, fixing would be good :)  Want me to open
> a bug tracker?

Please

>
> > A quick hack would be something like:
> >
> > if sys.path[0]=="":
> > 	sys.path[0] = 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.

I think Python established that sys.path entry from the cwd.  I think that
for a service (or for any Python program for that matter), we don't want
system32 on sys.path - either at the start or the end :)

Mark



More information about the Python-win32 mailing list