From 49cd6cc619fc7ce3a1be28a898af06be3cc2eb69 Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Sat, 19 Dec 2015 13:17:42 -0800 Subject: [PATCH 1/3] Off by one error in page info calculation --- ocrmypdf/pageinfo.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ocrmypdf/pageinfo.py b/ocrmypdf/pageinfo.py index d1d76929..ffc5ea9d 100644 --- a/ocrmypdf/pageinfo.py +++ b/ocrmypdf/pageinfo.py @@ -126,13 +126,13 @@ def _page_has_text(pdf, page): return False -def _pdf_get_pageinfo(infile, page: int): +def _pdf_get_pageinfo(infile, pageno: int): pageinfo = {} - pageinfo['pageno'] = page + pageinfo['pageno'] = pageno pageinfo['images'] = [] pdf = pypdf.PdfFileReader(infile) - page = pdf.pages[page - 1] + page = pdf.pages[pageno] pageinfo['has_text'] = _page_has_text(pdf, page) From e510f89792d3fbe4def6832f314ec6263a2d09c1 Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Mon, 21 Dec 2015 09:38:38 -0800 Subject: [PATCH 2/3] Python 2 warning message --- setup.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/setup.py b/setup.py index 7859fcd8..9df78fcf 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 # © 2015 James R. Barlow: github.com/jbarlow83 +from __future__ import print_function, unicode_literals from setuptools import setup from subprocess import Popen, STDOUT, check_output, CalledProcessError from string import Template @@ -9,6 +10,10 @@ import re import sys +if sys.version_info.major < 3: + print("Python 2 is not supported") + sys.exit(1) + missing_program = ''' The program '{program}' could not be executed or was not found on your system PATH. From 424b4b33b15b923d4d55929a8205f0570a6ce022 Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Mon, 4 Jan 2016 12:56:51 -0800 Subject: [PATCH 3/3] Just go right ahead and demand Python 3.4 --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 9df78fcf..a15d3908 100644 --- a/setup.py +++ b/setup.py @@ -10,8 +10,8 @@ import re import sys -if sys.version_info.major < 3: - print("Python 2 is not supported") +if sys.version_info < (3, 4): + print("Python 3.4 or newer is required") sys.exit(1) missing_program = '''