clips / clips/pattern

PDF parser not working

Open
#101 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
8.9k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

I tried the PDF download/parsing example here:
http://www.clips.ua.ac.be/pages/pattern-web#pdf

But ran into this issue:

Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.

from pattern.web import URL, PDF
url = URL('http://www.clips.ua.ac.be/sites/default/files/ctrs-002_0.pdf')
pdf = PDF(url.download())
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/Pattern-2.6-py2.7.egg/pattern/web/init.py", line 3775, in init
self.content = self._parse(path, format=output)
File "/usr/local/lib/python2.7/dist-packages/Pattern-2.6-py2.7.egg/pattern/web/init.py", line 3790, in _parse
raise PDFError(str(e))
pattern.web.PDFError: must be encoded string without NULL bytes, not str

Using latest version from Git under Ubuntu 14.04.

Cheers,
Tim

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 by reproducing the PDF example from the linked Pattern web documentation with the reported Python 2.7 environment. Inspect pattern/web/init.py around the PDF constructor at line 3775 and _parse at line 3790; done means the example parses the downloaded PDF without raising PDFError.

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
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.