Micka33 / Micka33/content-extractor

IndexError: list index out of range

Open
#4 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
36
Forks
11
PR merge metrics
No merged PRs in 30d

Description

I encounter this problem, though the examples are processed successfully.
File "general.py", line 12, in
json = main.run("Programming with PDFMiner.pdf", "./images/")
File "D:\codegit\python2.7\pdfminer\content-extractor-master\pdfreader\main.py", line 82, in run
dict_book = text_to_dict(pdf_file)
File "D:\codegit\python2.7\pdfminer\content-extractor-master\pdfreader\main.py", line 13, in text_to_dict
b = book(xml)
File "D:\codegit\python2.7\pdfminer\content-extractor-master\pdfreader\lib\book.py", line 20, in init
self._pages.append(page(p))
File "D:\codegit\python2.7\pdfminer\content-extractor-master\pdfreader\lib\page.py", line 17, in init
self._paragraphs.append(paragraph(p))
File "D:\codegit\python2.7\pdfminer\content-extractor-master\pdfreader\lib\paragraph.py", line 39, in init
self._lines.append(line(l))
File "D:\codegit\python2.7\pdfminer\content-extractor-master\pdfreader\lib\line.py", line 40, in init
self._chars.append(char(c))
File "D:\codegit\python2.7\pdfminer\content-extractor-master\pdfreader\lib\char.py", line 30, in init
self._font = xml_char.get('font').split('+')[1] if xml_char.get('font') != None else None
IndexError: list index out of range

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in pdfreader/lib/char.py at line 30, then trace the calls from pdfreader/lib/line.py, paragraph.py, page.py, and book.py. Reproduce the failure with the reported PDF and inspect the font values reaching char; done means processing that input no longer raises IndexError while the example inputs continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.