mark_eol_hyphen: 'NoneType' object has no attribute 'endswith'
Opened this issue · 0 comments
fwillo commented
Hi there!
I'm trying out the most recent version of your pdf-diff (git cloned it today, 6th April 2018) on Ubuntu 16.04. I compiled it manually with python 3.6.4 from anaconda (Unfortunately he found the package not over pip). lxml and lxslt are installed with conda. The installation log is provided here:
$ python setup.py install
running install
running bdist_egg
running egg_info
writing pdf_diff.egg-info/PKG-INFO
writing dependency_links to pdf_diff.egg-info/dependency_links.txt
writing entry points to pdf_diff.egg-info/entry_points.txt
writing requirements to pdf_diff.egg-info/requires.txt
writing top-level names to pdf_diff.egg-info/top_level.txt
reading manifest file 'pdf_diff.egg-info/SOURCES.txt'
writing manifest file 'pdf_diff.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/pdf_diff
copying build/lib/pdf_diff/__init__.py -> build/bdist.linux-x86_64/egg/pdf_diff
copying build/lib/pdf_diff/command_line.py -> build/bdist.linux-x86_64/egg/pdf_diff
byte-compiling build/bdist.linux-x86_64/egg/pdf_diff/__init__.py to __init__.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/pdf_diff/command_line.py to command_line.cpython-36.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying pdf_diff.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pdf_diff.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pdf_diff.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pdf_diff.egg-info/entry_points.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pdf_diff.egg-info/not-zip-safe -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pdf_diff.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pdf_diff.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
creating 'dist/pdf_diff-0.9.0-py3.6.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing pdf_diff-0.9.0-py3.6.egg
creating /users/share/programs/miniconda/envs/miniconda-36/lib/python3.6/site-packages/pdf_diff-0.9.0-py3.6.egg
Extracting pdf_diff-0.9.0-py3.6.egg to /users/share/programs/miniconda/envs/miniconda-36/lib/python3.6/site-packages
Adding pdf-diff 0.9.0 to easy-install.pth file
Installing pdf-diff script to /cluster/programs/miniconda/envs/miniconda-36/bin
Installed /users/share/programs/miniconda/envs/miniconda-36/lib/python3.6/site-packages/pdf_diff-0.9.0-py3.6.egg
Processing dependencies for pdf-diff==0.9.0
Searching for Pillow==5.0.0
Best match: Pillow 5.0.0
Adding Pillow 5.0.0 to easy-install.pth file
Using /users/share/programs/miniconda/envs/miniconda-36/lib/python3.6/site-packages
Searching for lxml==4.2.1
Best match: lxml 4.2.1
Processing lxml-4.2.1-py3.6-linux-x86_64.egg
lxml 4.2.1 is already the active version in easy-install.pth
Using /users/share/programs/miniconda/envs/miniconda-36/lib/python3.6/site-packages/lxml-4.2.1-py3.6-linux-x86_64.egg
Searching for diff-match-patch-python==1.0.2
Best match: diff-match-patch-python 1.0.2
Processing diff_match_patch_python-1.0.2-py3.6-linux-x86_64.egg
diff-match-patch-python 1.0.2 is already the active version in easy-install.pth
Using /users/share/programs/miniconda/envs/miniconda-36/lib/python3.6/site-packages/diff_match_patch_python-1.0.2-py3.6-linux-x86_64.egg
Finished processing dependencies for pdf-diff==0.9.0
I recieve the following error message when trying to compare two pdfs created with pdflatex.
$ pdf-diff main2.pdf ../v1/main.pdf > compare.png
Traceback (most recent call last):
File "/cluster/programs/miniconda/envs/miniconda-36/bin/pdf-diff", line 11, in <module>
load_entry_point('pdf-diff==0.9.0', 'console_scripts', 'pdf-diff')()
File "/cluster/programs/miniconda/envs/miniconda-36/lib/python3.6/site-packages/pdf_diff-0.9.0-py3.6.egg/pdf_diff/command_line.py", line 496, in main
changes = compute_changes(args.files[0], args.files[1], top_margin=float(args.top_margin), bottom_margin=float(args.bottom_margin))
File "/cluster/programs/miniconda/envs/miniconda-36/lib/python3.6/site-packages/pdf_diff-0.9.0-py3.6.egg/pdf_diff/command_line.py", line 14, in compute_changes
docs = [serialize_pdf(0, pdf_fn_1, top_margin, bottom_margin), serialize_pdf(1, pdf_fn_2, top_margin, bottom_margin)]
File "/cluster/programs/miniconda/envs/miniconda-36/lib/python3.6/site-packages/pdf_diff-0.9.0-py3.6.egg/pdf_diff/command_line.py", line 29, in serialize_pdf
for run in box_generator:
File "/cluster/programs/miniconda/envs/miniconda-36/lib/python3.6/site-packages/pdf_diff-0.9.0-py3.6.egg/pdf_diff/command_line.py", line 107, in mark_eol_hyphens
mark_eol_hyphen(box)
File "/cluster/programs/miniconda/envs/miniconda-36/lib/python3.6/site-packages/pdf_diff-0.9.0-py3.6.egg/pdf_diff/command_line.py", line 116, in mark_eol_hyphen
if box['text'].endswith("-"):
AttributeError: 'NoneType' object has no attribute 'endswith'
I assume I made an error during the installation? Or did I encounter a bug?