[Pywikipedia-l] SVN: [6096] trunk/pywikipedia/djvutext.py
nicdumz at svn.wikimedia.org
nicdumz at svn.wikimedia.org
Fri Nov 14 06:55:36 UTC 2008
Revision: 6096
Author: nicdumz
Date: 2008-11-14 06:55:36 +0000 (Fri, 14 Nov 2008)
Log Message:
-----------
identation fix + encoding of commands
Modified Paths:
--------------
trunk/pywikipedia/djvutext.py
Modified: trunk/pywikipedia/djvutext.py
===================================================================
--- trunk/pywikipedia/djvutext.py 2008-11-14 06:16:35 UTC (rev 6095)
+++ trunk/pywikipedia/djvutext.py 2008-11-14 06:55:36 UTC (rev 6096)
@@ -20,7 +20,7 @@
"""
__version__ = '$Id$'
import wikipedia
-import os
+import os, sys
import config, codecs
# This is required for the text that is shown when you run this script
@@ -89,8 +89,8 @@
self.prefix = linkingPage.titleWithoutNamespace()
if self.prefix[0:6] == 'Liber:':
self.prefix = self.prefix[6:]
- wikipedia.output(u"Using prefix %s" % self.prefix)
- gen = self.PagesGenerator()
+ wikipedia.output(u"Using prefix %s" % self.prefix)
+ gen = self.PagesGenerator()
site = wikipedia.getSite()
self.username = config.usernames[site.family.name][site.lang]
@@ -100,8 +100,8 @@
self.treat(pageno)
def has_text(self):
- cmd = "djvudump \"%s\" > \"%s\".out" % (self.djvu, self.djvu)
- os.system ( cmd )
+ cmd = u"djvudump \"%s\" > \"%s\".out" % (self.djvu, self.djvu)
+ os.system ( cmd.encode(sys.stdout.encoding) )
f = codecs.open("%s.out" % self.djvu, 'r', config.textfile_encoding, 'replace')
@@ -112,7 +112,7 @@
def get_page(self, pageno):
wikipedia.output(unicode("fetching page %d" % (pageno)))
cmd = "djvutxt -page=%d \"%s\" \"%s.out\"" % (pageno, self.djvu, self.djvu)
- os.system ( cmd )
+ os.system ( cmd.encode(sys.stdout.encoding) )
f = codecs.open("%s.out" % self.djvu, 'r', config.textfile_encoding, 'replace')
More information about the Pywikipedia-l
mailing list