Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting Assert Error on every PDF #35

Open
sof123 opened this issue Jan 23, 2017 · 1 comment
Open

Getting Assert Error on every PDF #35

sof123 opened this issue Jan 23, 2017 · 1 comment

Comments

@sof123
Copy link

sof123 commented Jan 23, 2017

Hey just trying to get started with slate using the tutorial and getting this error. I've tried with 3 pdfs now. Just running the basic code from the tutorial:

import slate with open('testpdf3.pdf') as f: print type(f) doc = slate.PDF(f)

And the stack trace:

Traceback (most recent call last):
File "test.py", line 7, in
doc = slate.PDF(f)
File "C:\Users\S\Anaconda2\lib\site-packages\slate\slate.py", line 38, in init
self.doc.set_parser(self.parser)
File "C:\Users\S\Anaconda2\lib\site-packages\pdfminer\pdfparser.py", line 318, in set_parser
self.xrefs = parser.read_xref()
File "C:\Users\S\Anaconda2\lib\site-packages\pdfminer\pdfparser.py", line 747, in read_xref
self.read_xref_from(pos, xrefs)
File "C:\Users\S\Anaconda2\lib\site-packages\pdfminer\pdfparser.py", line 727, in read_xref_from
xref.load(self, debug=self.debug)
File "C:\Users\S\Anaconda2\lib\site-packages\pdfminer\pdfparser.py", line 99, in load
self.load_trailer(parser)
File "C:\Users\S\Anaconda2\lib\site-packages\pdfminer\pdfparser.py", line 107, in load_trailer
assert kwd is self.KEYWORD_TRAILER
AssertionError

I've tried printing kwd and it's always an integer while KEYWORD_TRAILER is 'trailer'
Used this command to install:

pip install --upgrade --ignore-installed slate==0.3 pdfminer==20110515

I'm on Windows, Python 2.7.12

@TG0
Copy link

TG0 commented Jun 6, 2017

Try:

with open('testpdf3.pdf', 'rb') as f:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants