From: Peter Odding Date: 2010-09-11T19:25:04+09:00 Subject: Re: Rubyzip - `dup': can't dup NilClass (TypeError) Hi Scott, >> Whatever tool is generating them, it's already in widespread use. :( > > That might not actually be true... Most failing zipfiles were upped by > the same author. I'll ask Peter Odding what he used to zip them. I publish my Vim plug-ins with a Python script that uses the zipfile [1] module to generate ZIP files. All of the archives uploaded in the last few months were generated on Ubuntu 9.10 (Karmic) with Python 2.6, although I just yesterday upgraded my laptop to Ubuntu 10.4 (Lucid) so I can't check the exact version. The ZIP file generation comes down to the following code: from zipfile import ZipFile, ZIP_DEFLATED archive = ZipFile('easytags.zip', 'w', ZIP_DEFLATED) for filename in ['plugin/easytags.vim', 'autoload/easytags.vim', ...]: # This is where "git cat-file" is used, see below. with open(filename) as handle: archive.writestr(filename, handle.read()) archive.close() One peculiarity about the Python code is that it uses ZipFile.writestr() [2] instead of ZipFile.write() [3] so that it will only package committed versions of my scripts (using "git cat-file -p HEAD:some/file"). Let me know if you need any more information. If it helps I might be able to resurrect my old environment in a virtual machine, but I haven't tried yet. - Peter Odding [1] http://docs.python.org/library/zipfile.html [2] http://docs.python.org/library/zipfile.html#zipfile.ZipFile.writestr [3] http://docs.python.org/library/zipfile.html#zipfile.ZipFile.write -- Posted via http://www.ruby-forum.com/.