You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AttributeError: 'NoneType' object has no attribute 'strip' #19
I had the same error. In fact, run["text"] is equal to None when an element being parsed is not a word, but an image or a symbol (rendered latex \square symbol in my case).
Here is my solution:
defserialize_pdf(i, fn, top_margin, bottom_margin):
box_generator=pdf_to_bboxes(i, fn, top_margin, bottom_margin)
box_generator=mark_eol_hyphens(box_generator)
boxes= []
text= []
textlength=0forruninbox_generator:
ifrun["text"] isNone: # <--- I added these two linescontinue#normalized_text=run["text"].strip()
Since the script compares only the text in PDF, I just skipped to the next iteration when run["text"] = None.
Activity
tkkiran commentedon Jan 2, 2018
Have the same issue. When running in python3.5 inside a virtual environment.
wfranus commentedon Feb 20, 2018
I had the same error. In fact,
run["text"]is equal to None when an element being parsed is not a word, but an image or a symbol (rendered latex \square symbol in my case).Here is my solution:
Since the script compares only the text in PDF, I just skipped to the next iteration when run["text"] = None.
JoshData commentedon Feb 21, 2018
If you submit a pull request, I'd be glad to merge that fix.