I see. Well FWIW, entries which have errors are not guaranteed to show up in the output stream at all. It's unclear to me whether this is always the best outcome, but a long while ago I decided to do this for transactions and for some other directives. https://bitbucket.org/blais/beancount/src/d1b2cbf2841669e988f6692ec1d39db3708730cc/beancount/ops/balance.py#lines-119
I don't have a solution for you. This is an unusual case. On Fri, May 10, 2019 at 5:00 AM Florian Lindner <mailingli...@xgm.de> wrote: > Am 10.05.19 um 02:23 schrieb Martin Blais:> I read your message twice. I > don't understand what you're trying to do. > Sorry, for being unclear. I try to demonstrate it: > > % cat main.beancount > option "operating_currency" "EUR" > > 2018-05-01 open Equity:Opening-Balances > > 2018-05-01 open Assets:Giro > 2018-05-01 open Expenses:Unknown > > 2018-05-01 pad Assets:Giro Equity:Opening-Balances > 2018-05-02 balance Assets:Giro 10.00 EUR > > include "giro.beancount" > > % cat giro.beancount > 2018-05-11 * "Someone" "Somedesc" > Assets:Giro 100.00 EUR > Expenses:Unknown > > 2018-05-12 balance Assets:Giro 110.00 EUR > > % bean-check main.beancount > > Everything is fine. > > Now, in Python: > > entries, errors, options = beancount.loader.load_file("main.beancount") > > entries contains all entries, errors is empty. > > But if I load the giro.beancount file: > > entries, errors, options = beancount.loader.load_file("giro.beancount") > > errors contain Balance and Validation errors. Sure, because the account > declarations and padding from main.beancount are missing. > > The problem I have, is that entries does not contain all entries from the > file. Here, it contains only one transaction, the balance is omitted. > > Now, if I do some changes on the entries and write them out again using > > beancount.parser.printer.print_entries(transformed_entries, file = f) > > balances are not written to the file and information is lost. > > Because I want to read all entries of one file (which not necessarily > validates) and write them out to the same file, this is a problem for me. > > A workaround I see, is to read in main.beancount and write out the entries > to different files based on entries[6].meta["filename"]. Basically > rewriting the entire ledger. > > I hope, I was able to express my problem. > > Best Thanks, > Florian > > -- > 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 beancount+unsubscr...@googlegroups.com. > To post to this group, send email to beancount@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/beancount/fa979ce5-df09-4b3f-a758-f529920c4ba3%40googlegroups.com > <https://groups.google.com/d/msgid/beancount/fa979ce5-df09-4b3f-a758-f529920c4ba3%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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 beancount+unsubscr...@googlegroups.com. To post to this group, send email to beancount@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CAK21%2BhP-7%3DhdnimXodQfK2PsRgWRJaUvh1NziKzUzApEJGbF4Q%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.