zlib.so and libz.so and Python

DeepBleu DeepBleu at DeepBleu.org
Thu Feb 14 12:59:40 EST 2002

"Skip Montanaro" <skip at pobox.com> wrote in message
news:mailman.1013703624.30857.python-list at python.org...
>     DeepBleu> Python comes with zlib.so (for Sun OS).  But I noticed that
>     DeepBleu> the same machine, there is also libz.so.  Can someone please
>     DeepBleu> tell me what is the difference between these two and what
>     DeepBleu> libz.so is used for?
> "zlib" is the name of a Python module.  "zlib.so" is the runtime
> of that module.  My guess is that libz.so is a shared library version of
> C "zlib" library.  The Python module is essentially just a wrapper around
> the zlib library.  On my linux machine ldd shows that zlib.so depends on
> libz.so:
>     % ldd zlib.so
>             libz.so.1 => /lib/libz.so.1 (0x40015000)
>             libgcc_s.so.1 => /usr/local/lib/libgcc_s.so.1 (0x40024000)
>             libc.so.6 => /lib/libc.so.6 (0x4002c000)
>             /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)
> My guess is that you will see something similar on your Solaris system.
I used
% ldd zlib.so
         libz.so =>       /usr/openwin/lib/libz.so

So it means that in order to use compression/decompression in Python using
zlib module, one needs libz.so too.
The problem I am running into is that on one Solaris System (out of three),
I can not find libz.so.
and running
% ldd zlib.so
         libz.so =>       (file not found)

So on this partuclar machine, when I try using
from zipfile import ZipFile
new_zip_file = ZipFile("test.zip","w",8)

I am getting an error message that the zlib module is missing.

Where do I get the libz.so from?  Apparently it is included on newer Solaris
systems (I am guessing, since the machine it is not on happens to be a bit

>     DeepBleu> Also, I want to find out if zlib.so (the one that comes with
>     DeepBleu> the Python distribution) is all we need to work with ZIP
>     DeepBleu> in Python.
> Technically, I suppose you could, but I think you'll find it a heck of a
> easier to use the zipfile module (which uses zlib underneath the covers)
> work with ZIP files.
I know, I just meant if we also need libz.so in addition to zlib.so on the
system for zipfile etc... to work fine.
I am new to working on Solaris that is why I am a bit confused for now over
> --
> Skip Montanaro (skip at pobox.com - http://www.mojam.com/)

More information about the Python-list mailing list