[Pywikipedia-l] a small tweak that adds .7z support to the xmlreader (trunk)

Dmitry Chichkov dchichkov at gmail.com
Fri Apr 9 06:41:01 UTC 2010


Here's the patch:

--- pywikipedia/xmlreader.py    2010-03-26 22:45:58.000000000 -0700
+++ xmlreader.py    2010-04-08 23:35:51.000000000 -0700
@@ -285,6 +285,9 @@
         if self.filename.endswith('.bz2'):
             import bz2
             source = bz2.BZ2File(self.filename)
+        if self.filename.endswith('.7z'):
+            import subprocess
+            source = subprocess.Popen('7za e -bd -so %s 2>/dev/null' %
self.filename, shell=True, stdout=subprocess.PIPE, bufsize=65535).stdout
         else:
             # assume it's an uncompressed XML file
             source = open(self.filename)

-- Dc987
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wikimedia.org/pipermail/pywikipedia-l/attachments/20100408/318f3410/attachment.htm 


More information about the Pywikipedia-l mailing list