ofxparse
ofxparse copied to clipboard
Python3 "TypeError: must be str, not bytes"
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.