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

Python3 "TypeError: must be str, not bytes" #142

Open
stuartlangridge opened this issue Aug 3, 2018 · 0 comments
Open

Python3 "TypeError: must be str, not bytes" #142

stuartlangridge opened this issue Aug 3, 2018 · 0 comments

Comments

@stuartlangridge
Copy link

The code example in the README is

with codecs.open('file.ofx') as fileobj:
    ofx = OfxParser.parse(fileobj)

For Python3, this tends to throw a TypeError: must be str, not bytes error. The way to fix this is to open the file in binary mode:

with open("file.ofx", mode="rb") as fileobj:
    ofx = OfxParser.parse(fileobj)

and then everything's fine.

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

1 participant