Comments (6)
After merging #108, the parser is more lenient. My guess is that this will go away. If you are able, could you check if this is still an issue?
from ofxparse.
I continue to see similar issues with ofxparse 0.18.
My bank has exported an OFX file with the following empty fields:
CHECKNUM, FITID, NAME, CURDEF, BRANCHID, ACCTTYPE, REFNUM
(Being new to OFX file formats, I'm not sure whether this is actually valid, and whether the bank is at fault, or ofxparse should handle the case more gracefully?)
The stacktrace is
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/bin/hledger-autosync", line 11, in <module>
sys.exit(run())
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ledgerautosync/cli.py", line 311, in run
import_ofx(ledger, args)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ledgerautosync/cli.py", line 114, in import_ofx
ofx = OfxSynchronizer.parse_file(args.PATH)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ledgerautosync/sync.py", line 41, in parse_file
return OfxParser.parse(open(path))
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ofxparse/ofxparse.py", line 432, in parse
ofx_obj.accounts += cls.parseStmtrs(stmtrs_ofx, AccountType.Bank)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ofxparse/ofxparse.py", line 818, in parseStmtrs
account.curdef = act_curdef.contents[0].strip()
IndexError: list index out of range
from ofxparse.
Some unit tests would be helpful to check for this behavior. If I have time I'll create some.
from ofxparse.
I can add the OFX files I'm using as test cases on a PR. 2 x separate OFX files from Australian banks, both using version 1.02 (SGML!).
from ofxparse.
PR #143 added fixes for some elements, still some others to go.
from ofxparse.
Two sample STMTTRN entries, both using v1.02 spec:
<TRNTYPE>Credit</TRNTYPE>
<DTPOSTED>20180801</DTPOSTED>
<TRNAMT>0.0</TRNAMT>
<FITID></FITID>
<VALUEDATE>20180801</VALUEDATE>
<NAME></NAME>
<TRANSACTIONSPLIT>No</TRANSACTIONSPLIT>
<CATEGORY>Uncategorised</CATEGORY>
<ACCTBAL>-400.52</ACCTBAL>
<CHECKNUM></CHECKNUM>
<REFNUM></REFNUM>
<MEMO>NEW INTEREST RATE 3.870%</MEMO>
<CURRENCY>
<CURRATE>1.0000</CURRATE>
<CURSYM>AUD</CURSYM>
</CURRENCY>
</STMTTRN>```
and
```<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>20180801
<DTUSER>20180801
<TRNAMT>-10.00
<FITID>
<MEMO>Account Fee
</STMTTRN>```
Both have empty FITID fields. One has empty NAME field. Either empty or missing CHECKNUM and REFNUM fields.
Since transactions can be parsed by ofxparse if CHECKNUM, REFNAME, NAME and FITID are missing, empty fields should be handled in the same way.
Will try and put together a PR for these in the next few days.
from ofxparse.
Related Issues (20)
- Allow using OfxPrinter with a buffer rather than a file on disk
- Python3 "TypeError: must be str, not bytes"
- 'str' object has no attribute 'strftime' in ofxprinter HOT 1
- Not able to read file with iso-8859-1 encoding
- Changing <FITID> is not persisting at all HOT 1
- Make dtuser available in transaction object.
- OfxParser.parse fails: unknown encoding: cpNONE
- Importing ABC directly from collections module was removed in Python 3.9 HOT 3
- transaction.security and position.security should be Security() object instead of str HOT 1
- Read an OFX String instead of a OFX file HOT 4
- Transaction that is not a DEBIT nor a CREDIT HOT 2
- Missing BANKACCTTO on statement transaction
- Close tags HOT 2
- Does this parse ofx 1.0 format?
- OfxPreprocessedFile() crashes on an empty close tag like this: <MEMO/>
- Module 'collections' has no attribute 'Iterable' HOT 1
- Cannot process UTF-8 files with characters outside the 256 range HOT 1
- XMLParsedAsHTMLWarning HOT 4
- Bug with encoding for ETrade
- Handling Missing Decimal Separators in BALAMT Field for Brazilian OFX Files
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ofxparse.