>> >> (Decimal('12415.79'), 'EUR') >> >> Traceback (most recent call last): >> File "/usr/bin/bean-extract", line 4, in <module> >> from beancount.ingest.extract import main; main() >> File "/usr/lib/python3.7/site-packages/beancount/ingest/extract.py", line 257, in main >> return scripts_utils.trampoline_to_ingest(sys.modules[__name__]) >> File "/usr/lib/python3.7/site-packages/beancount/ingest/scripts_utils.py", line 174, in trampoline_to_ingest >> return run_import_script_and_ingest(parser) >> File "/usr/lib/python3.7/site-packages/beancount/ingest/scripts_utils.py", line 224, in run_import_script_and_ingest >> return ingest(importers_list) >> File "/usr/lib/python3.7/site-packages/beancount/ingest/scripts_utils.py", line 116, in ingest >> detect_duplicates_func=detect_duplicates_func) >> File "/usr/lib/python3.7/site-packages/beancount/ingest/extract.py", line 252, in run >> detect_duplicates_func=detect_duplicates_func) >> File "/usr/lib/python3.7/site-packages/beancount/ingest/extract.py", line 218, in extract >> print_extracted_entries(new_entries, output) >> File "/usr/lib/python3.7/site-packages/beancount/ingest/extract.py", line 140, in print_extracted_entries >> entry_string = printer.format_entry(entry) >> File "/usr/lib/python3.7/site-packages/beancount/parser/printer.py", line 339, in format_entry >> return EntryPrinter(dcontext, render_weights)(entry) >> File "/usr/lib/python3.7/site-packages/beancount/parser/printer.py", line 117, in __call__ >> method(obj, oss) >> File "/usr/lib/python3.7/site-packages/beancount/parser/printer.py", line 254, in Balance >> amount=entry.amount.to_string(self.dformat), >> AttributeError: 'tuple' object has no attribute 'to_string' >> >> when attached to the list of statements that is returned from the extract() function. Ok, problem was that I multiplied the amount with 1 or -1 which, for some reason, returns a tuple. Now I use the __neg__ function directly.
>> Also, I am obviosuly still having some problems crasping beancounts type system, esp. with optional parameters, like creating a transaction: >> >> txn = data.Transaction(meta, date, "*", payee, desc, set(), set(), [ >> data.Posting("Assets:Checking", units, None, None, None, None), >> data.Posting("Expenses:Unknown", None, None, None, None, None)]) >> >> took me some time to find out, that I need to pass set() to some empty arguments, None to others. >> >> My questions: >> >> * How can I programmatically create a balance assertion? > > > Here's what I'm using > > data.Balance( > > data.new_metadata(myFile, myLine), > myDate, > myAccount, > amount.Amount(D(myAmount), myCurrency), > None, > None, > ) 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/cd69725c-f952-412b-bdba-ca34476f64e9%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.