jseutter / ofxparse

Ofx file format parser for Python
http://sites.google.com/site/ofxparse/
MIT License
204 stars 121 forks source link

OfxParser.parse fails: unknown encoding: cpNONE #154

Open fugwort opened 4 years ago

fugwort commented 4 years ago

I downloaded some transactions from my bank using ofxget to a file. I I tried to parse the file with OfxParser.parse and got this: Traceback (most recent call last): File "./ofxParseTest.py", line 37, in <module> main() File "./ofxParseTest.py", line 11, in main ofx = OfxParser.parse(fileobj) File "/home/yates/.local/lib/python3.7/site-packages/ofxparse/ofxparse.py", line 387, in parse ofx_file = OfxPreprocessedFile(file_handle) File "/home/yates/.local/lib/python3.7/site-packages/ofxparse/ofxparse.py", line 147, in __init__ super(OfxPreprocessedFile, self).__init__(fh) File "/home/yates/.local/lib/python3.7/site-packages/ofxparse/ofxparse.py", line 78, in __init__ self.handle_encoding() File "/home/yates/.local/lib/python3.7/site-packages/ofxparse/ofxparse.py", line 125, in handle_encoding codec = codecs.lookup(encoding) LookupError: unknown encoding: cpNONE The first few lines of the file are: OFXHEADER:100 DATA:OFXSGML VERSION:160 SECURITY:NONE ENCODING:USASCII CHARSET:NONE COMPRESSION:NONE I discovered that by changing CHARSET:NONE to CHARSET:1252 OfxParser.parse would parse the file.