[IronPython] how to make zlib available?

Michael Foord fuzzyman at voidspace.org.uk
Fri May 28 01:17:54 PDT 2010


On 28/05/2010 01:25, Brandon Craig Rhodes wrote:
> 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"

With that dll on sys.path, try:

import clr
clr.AddReference('IronPython.Zlib')

Once you have successfully added a reference to the assembly you should 
then be able to import from it.

HTH,

Michael


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


-- 
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog

READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies (”BOGUS AGREEMENTS”) that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer.




More information about the Users mailing list