koodaamo / banking.statements.osuuspankki

Plugin for ofxstatement to read CSV files exported from the online banking service of the Finnish Osuuspankki bank.
GNU General Public License v3.0
4 stars 10 forks source link

Conversion fails with error: KeyError: 'account' #1

Closed jhellen closed 7 years ago

jhellen commented 9 years ago

What am I doing wrong here? I'm a noob with Python and got Python 2.7.10 and 3.5.4 installed on Win7 64bit.

Tried this:

ofxstatement convert -t op .\tapahtumat20150801-20150831.csv tapahtumat.ofx

got this:

Traceback (most recent call last): File "C:\Users\wizah\AppData\Local\Programs\Python\Python35\Scripts\ofxstatement-script.py", line 9, in load_entry_point('ofxstatement==0.5.0', 'console_scripts', 'ofxstatement')() File "c:\users\wizah\appdata\local\programs\python\python35\lib\site-packages\ofxstatement\tool.py", line 145, in ru n return args.func(args) File "c:\users\wizah\appdata\local\programs\python\python35\lib\site-packages\ofxstatement\tool.py", line 121, in co nvert parser = p.get_parser(args.input) File "c:\users\wizah\appdata\local\programs\python\python35\lib\site-packages\banking.statements.osuuspankki-1.3.2-p y3.5.egg\banking\statements\osuuspankki\plugin.py", line 20, in get_parser parser.statement.account_id = self.settings['account'] KeyError: 'account'

petri commented 9 years ago

You need to specify account & currency in an ofxstatement config file: see https://github.com/kedder/ofxstatement#advanced-configuration . Does that help?

jhellen commented 9 years ago

I've tried to create an op.ini file in the plugin directory like this [op:eur] plugin = banking.statements.osuuspankki charset = cp1257 currency = EUR account = FIXXXXXXXXXXXXXXXXX

... I've tried several different commands to convert. This 'ofxstatement convert -t op tapahtumat20150801-20150831.csv tapahtumat.ofx' gives the same error no matter where I place that .ini file.

This time on Ubuntu 14.04 64bit

Traceback (most recent call last): File "/usr/local/bin/ofxstatement", line 9, in load_entry_point('ofxstatement==0.6.0.dev', 'console_scripts', 'ofxstatement')() File "/usr/local/lib/python3.4/dist-packages/ofxstatement-0.6.0.dev-py3.4.egg/ofxstatement/tool.py", line 150, in run File "/usr/local/lib/python3.4/dist-packages/ofxstatement-0.6.0.dev-py3.4.egg/ofxstatement/tool.py", line 126, in convert File "/usr/local/lib/python3.4/dist-packages/banking/statements/osuuspankki/plugin.py", line 20, in get_parser parser.statement.account_id = self.settings['account'] KeyError: 'account'

petri commented 7 years ago

Perhaps ofxstatement can not find your config. I am not sure where it should be placed, or how it should be named, or maybe the block in the ini file should be called just "op"...?

Also, the name of the plugin to be entered in the config file is "op", not the full package name as you have...

I will take a look at this after ofxstatement 0.6.0 is released. For what it's worth, my current code (not yet pushed to github) works ok with that, with a config file, too.

petri commented 7 years ago

FYI, just pushed the updates. Master should work with ofxstatement master now.

jhellen commented 7 years ago

Thanks! I fiddled around this with this again and finally got it working. I tried to load the OFX file to HomeBank 5.1.2 and was surprised that it didn't add any Payees but instead it put the Payee name in the Memo field. Would have been nicer with both Payee and Memo fields :)

Seems like neither GnuCash or HomeBank imports that memo field from the ODF file even if the information is there.

jhellen commented 7 years ago

Just found the field mapping preferences in HomeBank that fixed this issue. Don't know if GnuCash has a similar setting but I don't use that either.

Kiitos!