Closed jord1e closed 3 years ago
When i have the script_utils.ingest method in my config i get the following error when starting Fava:
Calling script_utils.ingest
turns the whole python file into a script which is expected to be run directly (see https://github.com/beancount/beancount/blob/12e7c3d31d675341f31781c0b801c968ab3e625e/beancount/ingest/scripts_utils.py#L45). So that will conflict with Fava which tries to import this file. You should wrap the call to script_utils.ingest
in a if __name__ == "__main__"
block so that it isn't called when Fava imports it.
Fava will only see the importers as specified in CONFIG
. To apply some function to your imported entries, you should call that function in your importers extract method instead or use some helper like apply_hooks
from smart_importer to patch your importer class (https://github.com/beancount/smart_importer/blob/bb896bd437faec0a632e1372f3426b93c11810a7/smart_importer/hooks.py#L27)
I actually figured it out using Beancount plugins (beancount.fix_payees
). I am still wondering why i am getting invalid token
errors on the included file though.
Related to this, is there a way to disable the default hooks?
Unfortunately beancount uses the standard duplicate detector if you don't specify any hooks. This unfortunately marks entries as duplicates although they aren't.
I'm using the apply_hooks from smart importer, so I would not want any hooks from beancount to run.
Related to this, is there a way to disable the default hooks?
There's not, no. Do you want to open a new issue for that?
Yes, see #1197
I currently have a
ingest-config.py
file:In my main file i have the following options set:
When i have the
script_utils.ingest
method in my config i get the following error when starting Fava:But when i run
bean-extract ingest-config.py ingest > tmp.beancount
everything works fine. Removing thescript_utils.ingest
will ignore the hooks that i have defined to clean up my payees and add some metadata. Is there any way i can solve this?Also:
When i run
bean-extract
the following gets printed on the first line, is there any way to remove this? Fava gives me errors (which seems strange to me because when i paste the same contents in my main file i do not get any errors, maybe it's a bug):Fava version:
1.17
(Installed using pip on Debian WSL) Browser version: Latest Stable Firefox (83.0 64-bit) Beancount version with whichbean-extract
works:2.3.3 (git:36eca6bb; 2020-10-27)
(Installed using pip on Windows)