Giter VIP home page Giter VIP logo

Comments (6)

nathangrigg avatar nathangrigg commented on July 3, 2024

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.

bruny avatar bruny commented on July 3, 2024

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.

jseutter avatar jseutter commented on July 3, 2024

Some unit tests would be helpful to check for this behavior. If I have time I'll create some.

from ofxparse.

bruny avatar bruny commented on July 3, 2024

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.

bruny avatar bruny commented on July 3, 2024

PR #143 added fixes for some elements, still some others to go.

from ofxparse.

bruny avatar bruny commented on July 3, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.