Heyho,
Thanks for beancount, it is an awesome piece of technology!
My situation: My root file "root.beancount" includes sub files for all my
individual accounts, i.e "my_bank.beancount". What I'd like to do is run
over all Transactions in "my_bank.beancount", potentially changing the
Accounts in the postings of each Transaction and write it back out into the
file it was read from - keeping the order of the entries in the file.
I tried this:
entries, _, _ = beancount.loader.load_file("root.beancount")
for e in entries:
if not os.path.basename(e.meta['filename']) == "my_bank.beancount":
continue
if isinstance(e, data.Transaction):
change_around_account(e)
printer.print_entry(e)
This does not work as expected:
- it changes whitespace: while all my postings used to be indented by four
spaces, after running this they are only indented by 2.
- I have several "balance" and "note" statements in the file which get
reordered and empty lines inserted before and after. I understand that this
is insignificant for beancount, but the ordering is meaningful to me.
It is not too hard to parse out the individual pieces that I am interested
in the files and iterate over the items myself that way, but I wondered if
there was a blessed way of doing what I want.
Thanks,
Holger
--
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/ee96f9cd-6c7c-476a-8cb3-b380cad2219e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.