First, apologies, I'm very new to beancount, and only starting with python.
Right now I'm trying to just have a basic import working, and then will try
to enrich it. I've tried looking through documentation and mailing lists,
and this is as far as I managed to go with it.
"config" file test.config.py:
#!/usr/bin/env python3
'''
Configuration file for extracting MyBank data
'''
import sys
from os import path
# from beancount.ingest import extract
# from beancount.ingest.importers import csv
# from .importers import mybank
import importers.mybank
sys.path.insert(0, path.join(path.dirname(__file__)))
# from beancount.plugins import auto_accounts
CONFIG = [importers.mybank.Importer('Assets:Currency:MyBank')]
importer importers/mybank/__init__.py:
#!/usr/bin/env python3
'''
Configuration file for extracting MyBank data
'''
from beancount.ingest import regression
from beancount.ingest.importers import csv
from beancount.plugins import auto_accounts
class Importer(csv.Importer):
config = {csv.Col.DATE: 'Posted Date',
csv.Col.TXN_DATE: 'Transaction Date',
csv.Col.NARRATION1: 'Description',
csv.Col.NARRATION2: 'Payee',
csv.Col.NARRATION3: 'Payee account',
csv.Col.AMOUNT: 'Amount',
csv.Col.BALANCE: 'Balance'}
def __init__(self, account):
csv.Importer.__init__(
self, self.config,
account, 'Currency',
('Transacton Date,Posted Date,Description,Payee,'
'Payee account,Amount,Balance'),
1)
def get_description(self, row):
payee, narration = super().get_description()
narration = '{} ({})'.format(narration, row.category)
return payee, narration
Yes, importers/__init__.py exists and is empty
Trying to run bean-identify (from the directory where directory with
importers is) with this is very unhappy with me:
$ bean-identify test.config.py bank_history_sample.csv
Traceback (most recent call last):
File "/usr/bin/bean-identify", line 4, in <module>
from beancount.ingest.identify import main; main()
File "/usr/lib/python3.6/site-packages/beancount/ingest/identify.py",
line 93, in main
_, config, downloads_directories = scripts_utils.parse_arguments(parser)
File
"/usr/lib/python3.6/site-packages/beancount/ingest/scripts_utils.py", line
56, in parse_arguments
mod = runpy.run_path(args.config)
File "/usr/lib/python3.6/runpy.py", line 263, in run_path
pkg_name=pkg_name, script_name=fname)
File "/usr/lib/python3.6/runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "test.config.py", line 15, in <module>
import importers.mybank
ModuleNotFoundError: No module named 'importers'
What am I doing wrong and how should I proceed from here?
--
You received this message because you are subscribed to the Google Groups
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/beancount/d5214445-c616-4541-bfeb-d0e9f6eaf114%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.