henriquebastos / gnucash-to-beancount

Gnucash to Beancount Converter.
GNU General Public License v2.0
30 stars 19 forks source link

decimal.InvalidOperation: [<class 'decimal.DivisionUndefined'>] #4

Open gour opened 7 years ago

gour commented 7 years ago

Hello,

attempt to convert my personal Guncash file to Benacount results in:

gnucash-to-beancount personal.db > personal.beancount
Traceback (most recent call last):
  File "/home/gour/.virtualenvs/beancount/bin/gnucash-to-beancount", line 11, in <module>
    sys.exit(main())
  File "/home/gour/.virtualenvs/beancount/lib/python3.5/site-packages/gnucash_to_beancount/cli.py", line 39, in main
    entries = convert.load_entries(book)
  File "/home/gour/.virtualenvs/beancount/lib/python3.5/site-packages/gnucash_to_beancount/convert.py", line 35, in load_entries
    entries.append(TransactionWithPostings(txn))
  File "/home/gour/.virtualenvs/beancount/lib/python3.5/site-packages/gnucash_to_beancount/directives.py", line 140, in TransactionWithPostings
    return Transaction(txn, [Posting(split) for split in txn.splits])
  File "/home/gour/.virtualenvs/beancount/lib/python3.5/site-packages/gnucash_to_beancount/directives.py", line 140, in <listcomp>
    return Transaction(txn, [Posting(split) for split in txn.splits])
  File "/home/gour/.virtualenvs/beancount/lib/python3.5/site-packages/gnucash_to_beancount/directives.py", line 122, in Posting
    price = price_for(split)
  File "/home/gour/.virtualenvs/beancount/lib/python3.5/site-packages/gnucash_to_beancount/directives.py", line 110, in price_for
    number = abs(split.value / split.quantity)
decimal.InvalidOperation: [<class 'decimal.DivisionUndefined'>]

Any idea without having the source file?

xentac commented 7 years ago

I'm running into this same problem.

gour commented 7 years ago

@xentac I can confirm that your patch does help indeed. Thank you!

qiwei123 commented 6 years ago

I meet the same question