Merge pull request #142 from mawoqiw/master

Fixes needed to be able to compile pdfminer.six with Cython
pull/173/head
Tata Ganesh 2018-07-14 18:02:29 +05:30 committed by GitHub
commit d437e5c637
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

View File

@ -576,6 +576,7 @@ def ccittfaxdecode(data, params):
# test
def main(argv):
if not argv[1:]:
import unittest
return unittest.main()
class Parser(CCITTG4Parser):
@ -598,7 +599,7 @@ def main(argv):
pygame.image.save(self.img, 'out.bmp')
return
for path in argv[1:]:
fp = file(path, 'rb')
fp = open(path, 'rb')
(_, _, k, w, h, _) = path.split('.')
parser = Parser(int(w))
parser.feedbytes(fp.read())

View File

@ -426,7 +426,7 @@ class CMapParser(PSStackParser):
def main(argv):
args = argv[1:]
for fname in args:
fp = file(fname, 'rb')
fp = open(fname, 'rb')
cmap = FileUnicodeMap()
#cmap = FileCMap()
CMapParser(cmap, fp).run()

View File

@ -48,7 +48,7 @@ def convert(infp, outfp, path, codec='utf-8',
maxpages=0, maxfilesize=0, pagenos=None,
html=True):
# save the input file.
src = file(path, 'wb')
src = open(path, 'wb')
nbytes = 0
while 1:
data = infp.read(4096)
@ -68,7 +68,7 @@ def convert(infp, outfp, path, codec='utf-8',
layoutmode='exact')
else:
device = TextConverter(rsrcmgr, outfp, codec=codec, laparams=laparams)
fp = file(path, 'rb')
fp = open(path, 'rb')
interpreter = PDFPageInterpreter(rsrcmgr, device)
for page in PDFPage.get_pages(fp, pagenos, maxpages=maxpages):
interpreter.process_page(page)