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

error: Can't convert 'bytes' object to str implicitly #5

Open
neofyte opened this issue Jul 14, 2013 · 4 comments
Open

error: Can't convert 'bytes' object to str implicitly #5

neofyte opened this issue Jul 14, 2013 · 4 comments

Comments

@neofyte
Copy link

neofyte commented Jul 14, 2013

I am porting my script from python27 to python33.
When I run the code pdf = PdfFileReader(open('xxxx.pdf', 'rb')), the error message appears:

Traceback (most recent call last):
File ..., in <module>raw_content = pdf.getPage(0).extractText()
File "C:\Python33\lib\site-packages\PyPDF2\pdf.py", line 1718, in extract Textcontent = ContentStream(content, self.pdf)
File "C:\Python33\lib\site-packages\PyPDF2\pdf.py", line 1797, in __init__data += s.getObject().getData()
TypeError: Can't convert 'bytes' object to str implicitly

On the other hand, I cannot open the file with

pdf = PdfFileReader(open('xxxx.pdf', 'r'))

otherwise, it comes the following messages:

io.UnsupportedOperation: can't do nonzero end-relative seeks

What's going wrong?

@juankysmith
Copy link

I am having the same problem :( Have you found any solution?

@jdkanani
Copy link

Same problem :(

@james-see
Copy link

james-see commented May 26, 2016

According to docs you can't seek the end of a file without the beginning for python 3.2+. I am having the same issue.

@beigi
Copy link

beigi commented Feb 18, 2018

same problem

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

5 participants