[Pywikipedia-l] SVN: [6097] trunk/pywikipedia/djvutext.py
nicdumz at svn.wikimedia.org
nicdumz at svn.wikimedia.org
Fri Nov 14 07:05:29 UTC 2008
Revision: 6097
Author: nicdumz
Date: 2008-11-14 07:05:28 +0000 (Fri, 14 Nov 2008)
Log Message:
-----------
Fixes for non-ascii filenames, bis.
Modified Paths:
--------------
trunk/pywikipedia/djvutext.py
Modified: trunk/pywikipedia/djvutext.py
===================================================================
--- trunk/pywikipedia/djvutext.py 2008-11-14 06:55:36 UTC (rev 6096)
+++ trunk/pywikipedia/djvutext.py 2008-11-14 07:05:28 UTC (rev 6097)
@@ -59,8 +59,8 @@
self.ask = ask
def NoOfImages(self):
- cmd = "djvused -e 'n' \"%s\"" % (self.djvu)
- count = os.popen( cmd ).readline().rstrip()
+ cmd = u"djvused -e 'n' \"%s\"" % (self.djvu)
+ count = os.popen( cmd.encode(sys.stdout.encoding) ).readline().rstrip()
count = int(count)
wikipedia.output("page count = %d" % count)
return count
@@ -103,7 +103,7 @@
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')
+ f = codecs.open(u"%s.out" % self.djvu, 'r', config.textfile_encoding, 'replace')
s = f.read()
f.close()
@@ -111,10 +111,10 @@
def get_page(self, pageno):
wikipedia.output(unicode("fetching page %d" % (pageno)))
- cmd = "djvutxt -page=%d \"%s\" \"%s.out\"" % (pageno, self.djvu, self.djvu)
+ cmd = u"djvutxt -page=%d \"%s\" \"%s.out\"" % (pageno, self.djvu, self.djvu)
os.system ( cmd.encode(sys.stdout.encoding) )
- f = codecs.open("%s.out" % self.djvu, 'r', config.textfile_encoding, 'replace')
+ f = codecs.open(u"%s.out" % self.djvu, 'r', config.textfile_encoding, 'replace')
djvu_text = f.read()
f.close()
More information about the Pywikipedia-l
mailing list