Units needed to be an instance of Amount

On Thu, Sep 23, 2021, 07:48 Álvaro Aguilar <[email protected]>
wrote:

> I am writing an importer and I get an error when I try to create a balance
> entry. I am not sure if it is a bug or an issue with what I am doing.
>
> I have tested the code to create the balance entry separately and it
> creates a balance entry allright. But tracing the error it seems to run
> into problems when it tries to print all my entries.
>
> Does this ring a bell as to something I am clearly doing wrong or should I
> just post this as a potential bug to be investigated?
>
> Thanks for your help!!
>
> *Code in my importer:* (I have changed actual variables for hardcoded
> constants for simplicity):
>
> *    def extract(self, file, existing_entries=None):*
> *         new_entries = []*
>
> *         metadata = data.new_metadata(file.name <http://file.name>, 10)*
> *
>
>                bal_entry = data.Balance(metadata,*
> *                                  date(2020,7,10),*
> *                                   'account',*
> *                                   10,*
> *                                   None,*
> *                                   None)*
> *          new_entries.append(bal_entry)*
>           return new_entries
>
>
>        *The error I get when executing bean-extract:*
>
> *Traceback (most recent call last):*
> *  File "/home/alvaroaguilar/.envs/beancount/bin/bean-extract", line 33,
> in <module>*
> *    sys.exit(load_entry_point('beancount==2.3.4', 'console_scripts',
> 'bean-extract')())*
> *  File
> "/home/alvaroaguilar/.envs/beancount/lib/python3.6/site-packages/beancount/ingest/scripts_utils.py",
> line 36, in extract_main*
> *    return trampoline_to_ingest(extract)*
> *  File
> "/home/alvaroaguilar/.envs/beancount/lib/python3.6/site-packages/beancount/ingest/scripts_utils.py",
> line 198, in trampoline_to_ingest*
> *    return run_import_script_and_ingest(parser)*
> *  File
> "/home/alvaroaguilar/.envs/beancount/lib/python3.6/site-packages/beancount/ingest/scripts_utils.py",
> line 246, in run_import_script_and_ingest*
> *    return ingest(importers_list)*
> *  File
> "/home/alvaroaguilar/.envs/beancount/lib/python3.6/site-packages/beancount/ingest/scripts_utils.py",
> line 140, in ingest*
> *    args.command(args, parser, importers_list, abs_downloads,
> hooks=hooks)*
> *  File
> "/home/alvaroaguilar/.envs/beancount/lib/python3.6/site-packages/beancount/ingest/extract.py",
> line 248, in run*
> *    hooks=hooks)*
> *  File
> "/home/alvaroaguilar/.envs/beancount/lib/python3.6/site-packages/beancount/ingest/extract.py",
> line 214, in extract*
> *    print_extracted_entries(new_entries, output)*
> *  File
> "/home/alvaroaguilar/.envs/beancount/lib/python3.6/site-packages/beancount/ingest/extract.py",
> line 137, in print_extracted_entries*
> *    entry_string = printer.format_entry(entry)*
> *  File
> "/home/alvaroaguilar/.envs/beancount/lib/python3.6/site-packages/beancount/parser/printer.py",
> line 369, in format_entry*
> *    return EntryPrinter(dcontext, render_weights, prefix=prefix)(entry)*
> *  File
> "/home/alvaroaguilar/.envs/beancount/lib/python3.6/site-packages/beancount/parser/printer.py",
> line 123, in __call__*
> *    method(obj, oss)*
> *  File
> "/home/alvaroaguilar/.envs/beancount/lib/python3.6/site-packages/beancount/parser/printer.py",
> line 271, in Balance*
> *    if isinstance(entry.amount.number, Decimal)*
> *AttributeError: 'int' object has no attribute 'number'*
>
> --
> 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/9ade35c8-96da-4a2f-a193-f5639cc7f1ffn%40googlegroups.com
> <https://groups.google.com/d/msgid/beancount/9ade35c8-96da-4a2f-a193-f5639cc7f1ffn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAK21%2BhMt1op1zAEaQmGGUKs%2B%2BUq4Yrbkdpz7Dmb7%3D%3D%3D8ecSycA%40mail.gmail.com.

Reply via email to