Skip to content

Commit 9e06731

Browse files
authored
Merge pull request JoshData#16 from neiljp/py3_check
Useability changes (python3 check, import removal, stderr usage)
2 parents f095212 + 6928424 commit 9e06731

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

pdf_diff/command_line.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
#!/usr/bin/python3
22

3-
import sys, json, subprocess, io, os
3+
import sys
4+
5+
if sys.version_info[0] < 3:
6+
sys.exit("ERROR: Python version 3+ is required.")
7+
8+
import json, subprocess, io, os
49
from lxml import etree
510
from PIL import Image, ImageDraw, ImageOps
611

7-
from six import int2byte
8-
912
def compute_changes(pdf_fn_1, pdf_fn_2, top_margin=0):
1013
# Serialize the text in the two PDFs.
1114
docs = [serialize_pdf(0, pdf_fn_1, top_margin), serialize_pdf(1, pdf_fn_2, top_margin)]
@@ -455,8 +458,8 @@ def main():
455458
args = parser.parse_args()
456459

457460
def invalid_usage(msg):
458-
print('ERROR: %s' % (msg))
459-
parser.print_usage()
461+
sys.stderr.write('ERROR: %s%s' % (msg, os.linesep))
462+
parser.print_usage(sys.stderr)
460463
sys.exit(1)
461464

462465
# Validate style

0 commit comments

Comments
 (0)