[IronPython] how to make zlib available?

Brandon Craig Rhodes brandon at rhodesmill.org
Fri May 28 02:25:00 CEST 2010


Hey, everyone!

I am helping a client develop a new application that people will run on
Windows machines (among other places).  It occurred to us that third-
party developers will be wanting to extend his application by writing in
"familiar" languages like Visual Basic or C#.  The "Python for .NET"
project, which would have been one potential way to call third-party C#
code, looks to have been rather moribund for the last three years, so I
hesitated to recommend that we try it.

But I remembered how many positive tweets and URLs about IronPython I
have read over the last few months, and so I have convinced the client
to give me a day to explore getting the application running under
IronPython!

The first obstacles fell quickly, but now I am encountering a serious
obstacle: "zlib" is needed, and not only does something so basic not
come with IronPython (is it a licensing thing?), but my normal Python
installation in C:\Python26 does not seem to provide it as a separate
DLL - it must be built right into the Python executable, I guess since
the import mechanism itself might sometimes need it?

There seems to be a Windows-specific version of "zlib" available here:

http://bitbucket.org/jdhardy/ironpythonzlib/

But I can't get it working either.  Its binary distribution's
"IronPython.Zlib.dll" file gets completely ignored by IronPython, so far
as I can tell, if I put it on my "sys.path" - but maybe that's because
I'm using the most recent IronPython, "IronPython 2.6 for .NET 4.0" (as
its "C:\Program Files" directory styles itself)?  I have then attempted
to compile it myself, by installing Visual Studio Express and then
finding and running the "msbuild" command like this:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe IronPython.zlib.csproj

I mean, I'm not actually sure that command is meaningful, but I saw it
somewhere on Stack Overflow and it at least looks like it tries to
compile something.  But the result is an utter failure.  For one thing,
it can't find absolutely anything mentioned in the "csproj" file, whose
crazy "<HintPath>" paths are, well, crazy!  Who on earth has these
libraries sitting in locations under a "Bin" directory?  Anyway, I tried
to repair some of the "<HintPath>" elements by hand, and got a little
further, but now I'm somewhere in a tangled forest of incompatibility
involving the version number of something called "System.Core" (which
not only sounds important, but is declared by the error message to be a
"referenced assembly" which is impressively polysyllabic).

So:

1. What do *you* guys do every day when you need "zlib"?
2. Should its binary distro work with .NET 4.0 and I'm not trying hard enough?
3. If I need to compile it, how do I make the "csproj" file work on a
   system where things are not located in exactly the same places they
   are on jdhardy's system?

Thanks for any pointers - I would love to get this app running on
IronPython!  Not only would we get "real" threads and get to back down
from all of these "multiprocessing" experiments I have been doing
(because, wow, secondary processes are *heavyweights* under Windows!),
but we'd be able to interoperate with .NET and stuff.  Plus then I would
have a project that let me play with IronPython like the other cool
kids. :-)

-- 
Brandon Craig Rhodes   brandon at rhodesmill.org   http://rhodesmill.org/brandon



More information about the Ironpython-users mailing list