On Mon, Jan 9, 2017 at 8:54 PM, <[email protected]> wrote:
> Hi Martin,
>
> I thought it might be a bug because you seem to be a too good and careful
> coder to let an uncaught exception through.
>
Oh I make a lot of mistakes, don't worry.
> Here is the simplest file that causes an exception for me. It is the
> original transaction that caused it. Nothing sensitive there. Besides,
> Google already knows about it ;>) Just add USD to the two Expenses lines
> and everything is fine.
>
What version are you using?
Here's what the latest on the default branch does for me, which looks
appropriate:
bean-check test.beancount
/tmp/test.beancount:13: Failed to categorize posting 1
2016-11-16 * "BJ WHOLESALE #0209 HUDSON" "Groceries, Sonicare 4Pk"
txndate: 2016-11-15
Liabilities:US:FidelityVisa -77.26 USD
Expenses:PersonalCare 42.49 <class
'beancount.core.number.MISSING'>
Expenses:Food:Groceries 34.77 <class
'beancount.core.number.MISSING'>
/tmp/test.beancount:14: Failed to categorize posting 2
2016-11-16 * "BJ WHOLESALE #0209 HUDSON" "Groceries, Sonicare 4Pk"
txndate: 2016-11-15
Liabilities:US:FidelityVisa -77.26 USD
Expenses:PersonalCare 42.49 <class
'beancount.core.number.MISSING'>
Expenses:Food:Groceries 34.77 <class
'beancount.core.number.MISSING'>
>
> Jonathan
>
> ;; -*- mode: org; mode: beancount; coding: utf-8; -*-
> **** /Users/jonathan/Documents/Beancount/documents/Expenses/
> Fidelity/2016-12-28FidelityVisa.csv
>
> ** Fidelity Investments
>
> 1982-01-01 open Liabilities:US:FidelityVisa USD
>
>
>
> 2016-11-16 * "BJ WHOLESALE #0209 HUDSON" | "Groceries, Sonicare 4Pk"
> txndate: 2016-11-15
> Liabilities:US:FidelityVisa -77.26 USD
> Expenses:PersonalCare 42.49
> Expenses:Food:Groceries 34.77
>
> * Expenses
> 1957-06-25 open Expenses:Food:Groceries
> 1957-06-25 open Expenses:PersonalCare
>
>
>
> On Sunday, January 8, 2017 at 11:41:48 PM UTC-5, Martin Blais wrote:
>>
>> This looks like a bug. This should not happen. Beancount should never
>> raise an uncaught exception.
>>
>> Could you copy your input, isolate the offending transaction, and wittle
>> it down to the smallest file that will reproduce the problem? Replace
>> numbers and other private things if needed. I'd appreciate, would save me
>> time. You can email to me directly if you're concerned about privacy.
>>
>> Thanks,
>>
>>
>>
>>
>>
>> On Sun, Jan 8, 2017 at 9:07 PM, <[email protected]> wrote:
>>
>>> Hi Martin,
>>>
>>> Happy New Year!
>>>
>>> I wasn't sure if this should be entered as an issue, thought I would let
>>> you decide. I am working on importing my credit card statements by running
>>> bean-extract and saving to a file, copying the credit card opening
>>> statement and expenses to the new file, and then adding the other half of
>>> the transactions. When I ran bean-check on the completed file, I got the
>>> following error. I figured I must have missed something in the new file,
>>> so I copied all the completed transactions to my normal beancount file,
>>> which had passed bean-check. It then incurred the same error. By process
>>> of elimination, I found I had missed putting the 'USD' after a
>>> transaction. After adding the 'USD', bean-check worked fine. Your code
>>> seems to handle most other errors, so I didn't think the Traceback was your
>>> way of notifying of a syntax error.
>>>
>>> Jonathan
>>>
>>>
>>> Enter code here...JFSMini1:Beancount$ bean-check jfsgmsbgn.bean
>>>
>>> Traceback (most recent call last):
>>>
>>> File "/usr/local/bin/bean-check", line 2, in <module>
>>>
>>> from beancount.scripts.check import main; main()
>>>
>>> File "/Library/Frameworks/Python.framework/Versions/3.5/lib/pytho
>>> n3.5/site-packages/beancount/scripts/check.py", line 39, in main
>>>
>>> extra_validations=validation.HARDCORE_VALIDATIONS)
>>>
>>> File "/Library/Frameworks/Python.framework/Versions/3.5/lib/pytho
>>> n3.5/site-packages/beancount/loader.py", line 87, in load_file
>>>
>>> extra_validations, encoding)
>>>
>>> File "/Library/Frameworks/Python.framework/Versions/3.5/lib/pytho
>>> n3.5/site-packages/beancount/loader.py", line 200, in wrapped
>>>
>>> result = function(toplevel_filename, *args, **kw)
>>>
>>> File "/Library/Frameworks/Python.framework/Versions/3.5/lib/pytho
>>> n3.5/site-packages/beancount/loader.py", line 219, in _load_file
>>>
>>> return _load([(filename, True)], *args, **kw)
>>>
>>> File "/Library/Frameworks/Python.framework/Versions/3.5/lib/pytho
>>> n3.5/site-packages/beancount/loader.py", line 460, in _load
>>>
>>> extra_validations)
>>>
>>> File "/Library/Frameworks/Python.framework/Versions/3.5/lib/pytho
>>> n3.5/site-packages/beancount/ops/validation.py", line 395, in validate
>>>
>>> new_errors = validation_function(entries, options_map)
>>>
>>> File "/Library/Frameworks/Python.framework/Versions/3.5/lib/pytho
>>> n3.5/site-packages/beancount/ops/validation.py", line 348, in
>>> validate_check_transaction_balances
>>>
>>> "Transaction does not balance: {}".format(residual),
>>>
>>> File "/Library/Frameworks/Python.framework/Versions/3.5/lib/pytho
>>> n3.5/site-packages/beancount/core/inventory.py", line 104, in __str__
>>>
>>> return self.to_string()
>>>
>>> File "/Library/Frameworks/Python.framework/Versions/3.5/lib/pytho
>>> n3.5/site-packages/beancount/core/inventory.py", line 96, in to_string
>>>
>>> ', '.join(pos.to_string(dformat) for pos in sorted(self)))
>>>
>>> File "/Library/Frameworks/Python.framework/Versions/3.5/lib/pytho
>>> n3.5/site-packages/beancount/core/position.py", line 228, in __lt__
>>>
>>> return self.sortkey() < other.sortkey()
>>>
>>> File "/Library/Frameworks/Python.framework/Versions/3.5/lib/pytho
>>> n3.5/site-packages/beancount/core/position.py", line 210, in sortkey
>>>
>>> order_units = CURRENCY_ORDER.get(currency, NCURRENCIES +
>>> len(currency))
>>>
>>> TypeError: object of type 'type' has no len()
>>>
>>> --
>>> 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/ms
>>> gid/beancount/df2169e7-a716-496d-9eb8-d38ea670c4da%40googlegroups.com
>>> <https://groups.google.com/d/msgid/beancount/df2169e7-a716-496d-9eb8-d38ea670c4da%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> 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/c622641e-77c4-44ee-bb28-ef95e55e2142%40googlegroups.com
> <https://groups.google.com/d/msgid/beancount/c622641e-77c4-44ee-bb28-ef95e55e2142%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>
--
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/CAK21%2BhOOGe6M-V0R%3DKWZT%2BKZsoPAf0JLRM%2BJfTBxLe%3DS0NfFVA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.