On Sat, May 08, 2021 at 09:40:17PM +0800, Oon-Ee Ng wrote:
> So creating a new Transaction looks something like the below:-
>
> meta = data.new_metadata(file.name, lineno)
> txn = data.Transaction(
> meta, date, self.FLAG, None, description,
> data.EMPTY_SET, data.EMPTY_SET, [
> data.Posting(account_name, amount_val, None, None,
> None, None),
> data.Posting(account_name_2, -amount_val, None, None,
> None, None)
> ]
> )
>
> If I don't specify metadata at all (use an empty dictionary) then it will
> throw a KeyError from line 586 in core/data.py in entry_sortkey
>
> But if I just specify a nonsense value (identical across all transactions)
> it works, and doesn't affect anything else.
>
> Does it make more sense not to require metadata at all when creating
> Transactions?
I've run into a similar issue when my plugins emit errors. If I leave
the source field of the error empty (None or {}), then beancount raises
an exception somewhere (I could check if it's useful).
Normally I can just copy the meta attribute od the entry that caused
the error, but some of my errors don't correspond to a particular entry
--- e.g. end-of-day checks, or syntax errors in the configuration. In
those cases, I set source to {"filename": None, "lineno": None} just to
appease beancount, but it feels silly.
--
James
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/beancount/20210508140818.rajhpulbmvxsgftq%40moth.falsifian.org.