Popular Python recipes tagged "meta:requires=zipfile"http://code.activestate.com/recipes/langs/python/tags/meta:requires=zipfile/2014-07-05T18:47:47-07:00ActiveState Code RecipesInMemoryZip class (Python) 2013-09-23T06:44:23-07:00Thomas Lehmannhttp://code.activestate.com/recipes/users/4174477/http://code.activestate.com/recipes/578667-inmemoryzip-class/ <p style="color: grey"> Python recipe 578667 by <a href="/recipes/users/4174477/">Thomas Lehmann</a> (<a href="/recipes/tags/file/">file</a>, <a href="/recipes/tags/memory/">memory</a>, <a href="/recipes/tags/path/">path</a>, <a href="/recipes/tags/zip/">zip</a>). </p> <p><strong>Why implementing this?</strong></p> <ul> <li>transfering a file or a folder (including sub folders) to another machine</li> <li>therefore zipping content to one compressed buffer</li> <li>keeping the relating ZIP in memory only but ...</li> <li>being able to save or load too</li> <li>and being able to unzip again at target destination</li> </ul> Offline Version Control (online with dropbox) (Python) 2013-07-07T15:18:51-07:00commentator8http://code.activestate.com/recipes/users/4182761/http://code.activestate.com/recipes/578592-offline-version-control-online-with-dropbox/ <p style="color: grey"> Python recipe 578592 by <a href="/recipes/users/4182761/">commentator8</a> (<a href="/recipes/tags/control/">control</a>, <a href="/recipes/tags/version/">version</a>). </p> <p>A basic form of version control that when used in combination with dropbox and notepad++ (optional) provides reliable backup with tags of files/folder.</p> <p>Files mode can be used for individual files, in practice i used it with python files primarily. Folder mode allows for backup of folders, especially useful for a class split over various files with __init__.py in root of a folder.</p> jardiff (Python) 2011-03-22T15:00:28-07:00Raphaël Jolivethttp://code.activestate.com/recipes/users/4135673/http://code.activestate.com/recipes/577620-jardiff/ <p style="color: grey"> Python recipe 577620 by <a href="/recipes/users/4135673/">Raphaël Jolivet</a> (<a href="/recipes/tags/diff/">diff</a>, <a href="/recipes/tags/jar/">jar</a>, <a href="/recipes/tags/war/">war</a>, <a href="/recipes/tags/zip/">zip</a>). </p> <p>Diff JAR / WAR / ZIP files (even recursively bundled).</p> <p>Possibility to ignore some files, or some patterns in text files (like MANIFEST.mf).</p> <p>This script is useful in order to know if a new build has changed anything to your binary JAR/WAR/Zip.</p> Download chromium browser nightly builds for any OS (with proxy support) (Python) 2014-07-05T18:47:47-07:00ccpizzahttp://code.activestate.com/recipes/users/4170754/http://code.activestate.com/recipes/577162-download-chromium-browser-nightly-builds-for-any-o/ <p style="color: grey"> Python recipe 577162 by <a href="/recipes/users/4170754/">ccpizza</a> (<a href="/recipes/tags/chrome/">chrome</a>, <a href="/recipes/tags/chromium/">chromium</a>, <a href="/recipes/tags/download/">download</a>, <a href="/recipes/tags/unzip/">unzip</a>). Revision 19. </p> <p>Downloads the latest Chromium browser build from <a href="http://commondatastorage.googleapis.com/chromium-browser-continuous/" rel="nofollow">http://commondatastorage.googleapis.com/chromium-browser-continuous/</a> using urllib2 or wget (with Python versions below 2.5) and unzips the downloaded zip file to a predefined folder.</p> <p>To use a custom proxy define the <code>HTTP_PROXY</code> system variable.</p> <p>The script will figure out the OS but you can also pass the platform as the first parameter (one of <code>win32, linux, linux64, mac</code>).</p> <p><em>Prerequisites (!! only for Python versions below 2.5):</em></p> <ul> <li><p><code>wget</code> - usually already installed on most linux systems. Windows users can get it <a href="http://gnuwin32.sourceforge.net/packages/wget.htm">here</a>.</p></li> <li><p><code>unzip</code> - used for unpacking the archive; usually already installed on most linux systems. Windows users can get it <a href="http://gnuwin32.sourceforge.net/packages/unzip.htm">here</a>.</p></li> </ul> <p>Both <code>wget</code> and <code>unzip</code> should be available in PATH (for Python 2.5+ native Python modules are used).</p> <p>For most Linux distros this script does not make much sense since the built-in package managers do a better job of managing chromium builds and dependencies, but it still can be useful if you are using a stable Chromium build but would like to be able to test the nightly builds too.</p> <p>For OSX an additional installation step will be performed using the <code>install.sh</code> that is included in the OSX build. The OSX installer will copy the package to <code>~/Applications/Chromium</code>, and set some permissions that are required for Chromium to run. Running the unpacked zip without doing the installation will most likely will not work because of missing executable permissions on some files.</p> ZipScript: Build a directly executable zipped Python script set (Python) 2010-02-11T15:32:38-08:00Glennhttp://code.activestate.com/recipes/users/4171639/http://code.activestate.com/recipes/577042-zipscript-build-a-directly-executable-zipped-pytho/ <p style="color: grey"> Python recipe 577042 by <a href="/recipes/users/4171639/">Glenn</a> (<a href="/recipes/tags/package/">package</a>, <a href="/recipes/tags/script/">script</a>, <a href="/recipes/tags/zip/">zip</a>). Revision 2. </p> <p>This function will package a python script and additional python modules, in either source or compiled form. Either are directly executable by Python 2.7/3.1 or newer.</p> <p>Uses make-like logic to only rebuild if something is newer than the previous build.</p> Extract a compressed file (Python) 2009-04-09T08:19:34-07:00Sridhar Ratnakumarhttp://code.activestate.com/recipes/users/4169511/http://code.activestate.com/recipes/576714-extract-a-compressed-file/ <p style="color: grey"> Python recipe 576714 by <a href="/recipes/users/4169511/">Sridhar Ratnakumar</a> . Revision 2. </p> <p>This recipe can be used to extract any zip or tar.gz/tar.bz2 file.</p> TimedCompressedRotatingFileHandler (Python) 2007-02-28T08:16:44-08:00Angel Freirehttp://code.activestate.com/recipes/users/4037917/http://code.activestate.com/recipes/502265-timedcompressedrotatingfilehandler/ <p style="color: grey"> Python recipe 502265 by <a href="/recipes/users/4037917/">Angel Freire</a> (<a href="/recipes/tags/debugging/">debugging</a>). </p> <p>Python has really nice logging framework, it has too a zipfile library in the default installation that makes you able to write compressed files.</p> <p>Several of the logging handlers "rotate" files, by size, date, etc. Here is an example of handler class for the logging framework that, when the file is rotated, it will make a .zip of the old file.</p> File Unzip (lite) (Python) 2005-12-30T05:13:58-08:00vishnubobhttp://code.activestate.com/recipes/users/2719919/http://code.activestate.com/recipes/465649-file-unzip-lite/ <p style="color: grey"> Python recipe 465649 by <a href="/recipes/users/2719919/">vishnubob</a> (<a href="/recipes/tags/algorithms/">algorithms</a>). Revision 3. </p> <p>This is a rewrite of &lt;a href="http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/252508"&gt;Doug Tolton's&lt;/a&gt; extract algorithm. It's portable and small, ideal for paste-and-use. NB: directory structure creation is slightly pendantic to ensure creation of implicit directories annotated by certain trixter zipfiles. cStringIO guards against errors writing large files over 128MB in size.</p> 'Zip walker' - Zip file tree generator (Python) 2005-06-16T02:54:02-07:00Anandhttp://code.activestate.com/recipes/users/760763/http://code.activestate.com/recipes/425840-zip-walker-zip-file-tree-generator/ <p style="color: grey"> Python recipe 425840 by <a href="/recipes/users/760763/">Anand</a> (<a href="/recipes/tags/files/">files</a>). </p> <p>A generator which provides a quick way to 'walk' a zip file archive. The generator can process multiple zip archives, i.e zip files which contain zip files. Inspired by the os.walk function.</p> Read OpenOffice Spreadsheet as list of lists (without UNO) (Python) 2005-11-28T11:34:46-08:00Romano Giannettihttp://code.activestate.com/recipes/users/2508634/http://code.activestate.com/recipes/436066-read-openoffice-spreadsheet-as-list-of-lists-witho/ <p style="color: grey"> Python recipe 436066 by <a href="/recipes/users/2508634/">Romano Giannetti</a> (<a href="/recipes/tags/text/">text</a>). Revision 3. </p> <p>This is a quick-and-dirty snippet that read a OpenOffice 1.1 spreadsheet (.sxc files) as a list of lists, every list representing a oocalc row. The row contents are unicode object with the "string" content of the cell. This snippet used as a program will convert .sxc files into comma-separated-values (csv) on the command line. Style is not perfect and could be greatly enhanced, but it works for me as is...</p> pyArchive (Python) 2004-12-13T11:16:36-08:00Charles Nicholshttp://code.activestate.com/recipes/users/818943/http://code.activestate.com/recipes/358412-pyarchive/ <p style="color: grey"> Python recipe 358412 by <a href="/recipes/users/818943/">Charles Nichols</a> (<a href="/recipes/tags/programs/">programs</a>). </p> <p>Windows backup utility, with remote copy, and auto cleanup. Uses zip libs. Used in a production network environment and works very well dumping both target files and remote target files over the network so you are not limited to saving a copy local.</p> OpenOffice to xml and/or text (oo2txt) (Python) 2004-08-30T17:01:40-07:00Dirk Holtwickhttp://code.activestate.com/recipes/users/2010148/http://code.activestate.com/recipes/302633-openoffice-to-xml-andor-text-oo2txt/ <p style="color: grey"> Python recipe 302633 by <a href="/recipes/users/2010148/">Dirk Holtwick</a> (<a href="/recipes/tags/text/">text</a>). Revision 2. </p> <p>OpenOffice is very popular. Some people may be interested in indexing the contents of their documents written with OpenOffice. Here is a very simple solution for that.</p> File Unzip (Python) 2005-04-29T05:29:48-07:00Doug Toltonhttp://code.activestate.com/recipes/users/468468/http://code.activestate.com/recipes/252508-file-unzip/ <p style="color: grey"> Python recipe 252508 by <a href="/recipes/users/468468/">Doug Tolton</a> (<a href="/recipes/tags/files/">files</a>). Revision 2. </p> <p>A Python class to extract zip files. It's also written for easy use as a standalone script from the commandline.</p> FSList (Python) 2004-01-01T08:14:10-08:00Eamonn Sullivanhttp://code.activestate.com/recipes/users/1466341/http://code.activestate.com/recipes/259147-fslist/ <p style="color: grey"> Python recipe 259147 by <a href="/recipes/users/1466341/">Eamonn Sullivan</a> (<a href="/recipes/tags/files/">files</a>). </p> <p>A subclass of the list object for managing files system objects (files, directories, etc.)</p> installing source distributions on windows (Python) 2002-04-10T20:04:47-07:00Thomas Hellerhttp://code.activestate.com/recipes/users/98141/http://code.activestate.com/recipes/117248-installing-source-distributions-on-windows/ <p style="color: grey"> Python recipe 117248 by <a href="/recipes/users/98141/">Thomas Heller</a> (<a href="/recipes/tags/sysadmin/">sysadmin</a>). Revision 5. </p> <p>Distutil's bdist_wininst installers offer uninstallation support for Python extensions, many developers however only distribute sources in zip or tar.gz format. The typical steps to install such a distribution are: - download the file - unpack with winzip into a temporary directory - open a command prompt and type 'python setup.py install' - remove the temporary directory</p> <p>This script unpacks a source distribution into a temporary directory, builds a windows installer on the fly, executes it, and cleans everything up afterward.</p> handling a zip inside a string (Python) 2002-03-22T10:38:08-08:00Indyana Joneshttp://code.activestate.com/recipes/users/283844/http://code.activestate.com/recipes/117263-handling-a-zip-inside-a-string/ <p style="color: grey"> Python recipe 117263 by <a href="/recipes/users/283844/">Indyana Jones</a> . </p> <p>given a string that has the contents of a .zip, how to handle ? (or "on using StringIO and zipfile")</p> Poor man's Winzip (Python) 2001-12-27T08:14:15-08:00Dirk Krausehttp://code.activestate.com/recipes/users/140648/http://code.activestate.com/recipes/104733-poor-mans-winzip/ <p style="color: grey"> Python recipe 104733 by <a href="/recipes/users/140648/">Dirk Krause</a> . </p> <p>Maybe not too sophisticated, but a handy little tool I use for myself.</p> <p>This program does the three essential tasks that (at least) I need: 1. Unzip an archive to a folder 2. Zip a folder to an archive 3. Zip a (big) file to an archive</p> <p>Freeze it, drop it into the 'sendto' folder, and you have a very convenient way to use this program via right mouseclick/sendto->zip2folder.</p> Read data from .zip files (Python) 2001-03-14T17:22:33-08:00Paul Prescodhttp://code.activestate.com/recipes/users/11203/http://code.activestate.com/recipes/52265-read-data-from-zip-files/ <p style="color: grey"> Python recipe 52265 by <a href="/recipes/users/11203/">Paul Prescod</a> (<a href="/recipes/tags/files/">files</a>). </p> <p>Python can work directly with data in zip files. You can look at the list of items in the directory and work with the data files themselves.</p>