ofxparse icon indicating copy to clipboard operation
ofxparse copied to clipboard

Python3 "TypeError: must be str, not bytes"

Open stuartlangridge opened this issue 6 years ago • 0 comments

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.

stuartlangridge avatar Aug 03 '18 10:08 stuartlangridge