>
> 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.
>
I tried to apply the workaround I mentioned:
entries, error, option_map = bc.loader.load_file(args.inputfile)
sorted_entries = {} # file -> list of entries
for e in entries:
entry = transform_txn(e) if type(e) == data.Transaction else e
name = entry.meta["filename"]
sorted_entries[name] = sorted_entries.get(name, []) + [entry]
for filename in sorted_entries:
with open(filename, "w") as f:
bc.parser.printer.print_entries(sorted_entries[filename], file
= f)
A problem that shows up, is that in main.beancount I have some options set
(e.g. operation_currency). They don't show up in entries, but in
option_map. However, I don't know how to write them to file.
Another idea: At a first try, it seems that reading the entire file into a
string and use beancount.parser.parser.parse_many would work and also
parser the balances:
with open(args.inputfile, "r") as f:
instr = f.read()
entries = bc.parser.parser.parse_many(instr)
Seems to work fine so far. What do you think?
Best,
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 [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/04ece178-cb20-4f9f-9fe0-33076c88c1c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.