Looking for the mysterious zlib.py* files in Python 2.6.4 (32-bit) for Windows

Mark Lawrence breamoreboy at yahoo.co.uk
Fri Mar 5 03:01:37 CET 2010

python at bdurham.com wrote:
> In the process of building an EXE with py2exe, I noticed that
> there's no physical zlib files anywhere on my workstation.
> I can import zlib and use this module's features without problem.
> But when I query zlib.__file__, I get back an empty string.
> Where does the zlib code live? Is zlib a <built-in> in 2.6?
> The reason I question its '<built-in>' status is that when
> analyzing my 2.6 based Py2exe produced executables with
> DependencyWalker, I see references to a zlib.pyd file that
> doesn't exist anywhere on my system. I wonder if this is
> something I should be concerned about?
> Can someone explain this mystery to me?
> Thank you,
> Malcolm

Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit 
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
 >>> import zlib
 >>> help(zlib)
Help on built-in module zlib:



[snip the rest of the help output]

IIRC a pyd file is really a DLL, but for a built-in its included into in 
this case python26.dll.


Mark Lawrence

More information about the Python-list mailing list