bean-bake fails (urllib or bottle error?)

41 views
Skip to first unread message

man...@gmail.com

unread,
Aug 19, 2017, 6:12:21 AM8/19/17
to Beancount
I'm trying to bake some beans and getting the following error. Can anyone help diagnose this?

$bean-bake ./beancount.org foo
127.0.0.1 - - [19/Aug/2017 12:10:53] "GET /context/019bb9def5e08b60b60649539dbcc03e HTTP/1.1" 200 2923
127.0.0.1 - - [19/Aug/2017 12:10:53] "GET /context/85bbd928804e18ffd433ed10331e4ef5 HTTP/1.1" 200 2382
127.0.0.1 - - [19/Aug/2017 12:10:53] "GET /context/c30f370f37ae90001d90c7c10772f9c7 HTTP/1.1" 200 2379
127.0.0.1 - - [19/Aug/2017 12:10:53] "GET /context/5fe89567a95696bf7a8a7c4222a94910 HTTP/1.1" 200 2391
127.0.0.1 - - [19/Aug/2017 12:10:53] "GET /context/35066b99e6725465f3f39dcef7d6f756 HTTP/1.1" 200 2445
Traceback (most recent call last):
  File "/Users/mankoff/local/anaconda/bin/bottle.py", line 862, in _handle
    return route.call(**args)
  File "/Users/mankoff/local/anaconda/bin/bottle.py", line 1740, in wrapper
    rv = callback(*a, **ka)
  File "/Users/mankoff/local/anaconda/lib/python3.6/site-packages/beancount/web/web.py", line 1045, in wrapper
    return callback(*posargs, **kwargs)
  File "/Users/mankoff/local/anaconda/lib/python3.6/site-packages/beancount/web/web.py", line 400, in context_
    oss.write(context.render_entry_context(app.entries, app.options, entry))
  File "/Users/mankoff/local/anaconda/lib/python3.6/site-packages/beancount/reports/context.py", line 66, in render_entry_context
    accounts = sorted(getters.get_entry_accounts(entry), key=order.get)
TypeError: '<' not supported between instances of 'NoneType' and 'NoneType'
Traceback (most recent call last):
127.0.0.1 - - [19/Aug/2017 12:10:53] "GET /context/47b6c5dc95d3eebd992c66348736f320 HTTP/1.1" 500 781
  File "/Users/mankoff/local/anaconda/bin/bean-bake", line 4, in <module>
    from beancount.scripts.bake import main; main()
  File "/Users/mankoff/local/anaconda/lib/python3.6/site-packages/beancount/scripts/bake.py", line 247, in main
    bake_to_directory(opts, output_directory, opts.quiet, opts.full_mode)
  File "/Users/mankoff/local/anaconda/lib/python3.6/site-packages/beancount/scripts/bake.py", line 153, in bake_to_directory
    quiet)
  File "/Users/mankoff/local/anaconda/lib/python3.6/site-packages/beancount/web/web.py", line 1234, in scrape_webapp
    url_lists = scrape.scrape_urls(url_format, callback, ignore_regexp)
  File "/Users/mankoff/local/anaconda/lib/python3.6/site-packages/beancount/web/scrape.py", line 75, in scrape_urls
    response = urllib.request.urlopen(url_format.format(url))
  File "/Users/mankoff/local/anaconda/lib/python3.6/urllib/request.py", line 223, in urlopen
    return opener.open(url, data, timeout)
  File "/Users/mankoff/local/anaconda/lib/python3.6/urllib/request.py", line 532, in open
    response = meth(req, response)
  File "/Users/mankoff/local/anaconda/lib/python3.6/urllib/request.py", line 642, in http_response
    'http', request, response, code, msg, hdrs)
  File "/Users/mankoff/local/anaconda/lib/python3.6/urllib/request.py", line 570, in error
    return self._call_chain(*args)
  File "/Users/mankoff/local/anaconda/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/Users/mankoff/local/anaconda/lib/python3.6/urllib/request.py", line 650, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 500: Internal Server Error

Martin Blais

unread,
Aug 19, 2017, 5:54:59 PM8/19/17
to Beancount
On Sat, Aug 19, 2017 at 6:12 AM, <man...@gmail.com> wrote:
I'm trying to bake some beans and getting the following error. Can anyone help diagnose this?

$bean-bake ./beancount.org foo
127.0.0.1 - - [19/Aug/2017 12:10:53] "GET /context/019bb9def5e08b60b60649539dbcc03e HTTP/1.1" 200 2923
127.0.0.1 - - [19/Aug/2017 12:10:53] "GET /context/85bbd928804e18ffd433ed10331e4ef5 HTTP/1.1" 200 2382
127.0.0.1 - - [19/Aug/2017 12:10:53] "GET /context/c30f370f37ae90001d90c7c10772f9c7 HTTP/1.1" 200 2379
127.0.0.1 - - [19/Aug/2017 12:10:53] "GET /context/5fe89567a95696bf7a8a7c4222a94910 HTTP/1.1" 200 2391
127.0.0.1 - - [19/Aug/2017 12:10:53] "GET /context/35066b99e6725465f3f39dcef7d6f756 HTTP/1.1" 200 2445
Traceback (most recent call last):
  File "/Users/mankoff/local/anaconda/bin/bottle.py", line 862, in _handle
    return route.call(**args)
  File "/Users/mankoff/local/anaconda/bin/bottle.py", line 1740, in wrapper
    rv = callback(*a, **ka)
  File "/Users/mankoff/local/anaconda/lib/python3.6/site-packages/beancount/web/web.py", line 1045, in wrapper
    return callback(*posargs, **kwargs)
  File "/Users/mankoff/local/anaconda/lib/python3.6/site-packages/beancount/web/web.py", line 400, in context_
    oss.write(context.render_entry_context(app.entries, app.options, entry))
  File "/Users/mankoff/local/anaconda/lib/python3.6/site-packages/beancount/reports/context.py", line 66, in render_entry_context
    accounts = sorted(getters.get_entry_accounts(entry), key=order.get)
TypeError: '<' not supported between instances of 'NoneType' and 'NoneType'

It looks like you're hitting a TypeError on sorting.
This should not happen.
(I suspect something to do with renaming your 5 account types, yet this should never happen.)

Can you share a minimal subset of your file which still reproduces the problem?
(Feel free to share directly if you're more comfortable re. data privacy.)


 

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to bean...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/07af96c0-ad06-4a26-9a04-12d9a3a324a3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ken Mankoff

unread,
Aug 20, 2017, 12:09:27 AM8/20/17
to bean...@googlegroups.com

On 2017-08-19 at 21:54, Martin Blais <bl...@furius.ca> wrote:
> It looks like you're hitting a TypeError on sorting. This should not
> happen. (I suspect something to do with renaming your 5 account types,
> yet this should never happen.)

After bisecting the file I discovered that this is causing the error:

2017-08-10 pad Assets:Cash:DKK Expenses:Food:Restaurants
2017-08-11 balance Assets:Cash:DKK 1130 DKK

Is this incorrect syntax? "bean-check" reports no errors.

-k.

Martin Blais

unread,
Aug 20, 2017, 12:37:00 AM8/20/17
to Beancount
This is correct syntax.
This alone, by itself, does not generate the error.
Could you 
1. copy your file
2. remove bits and pieces, check the error still exists
3. repeat 2 as much as possible
4. share a minimal file, possibly removing private infos / changing numbers?
That would be very useful in figuring out where this bug comes from.



 

  -k.


--
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+unsubscribe@googlegroups.com.
To post to this group, send email to bean...@googlegroups.com.

Ken Mankoff

unread,
Aug 20, 2017, 1:37:12 AM8/20/17
to bean...@googlegroups.com
An MWE:

2007-01-01 open Assets:Cash:DKK DKK
2007-01-01 open Expenses:Food:Restaurants DKK,USD
2017-08-10 pad Assets:Cash:DKK Expenses:Food:Restaurants
2017-08-11 balance Assets:Cash:DKK 1130 DKK

Seems to be the "DKK,USD". I know you advise to keep each account as its own currency, but we live/work in two countries (and travel in others) and it just makes sense to have one restaurant budget and not sub-budgets by currency. Maybe I'm missing something here in the bookkeeping/finance/organization logic?

-k.



On 2017-08-20 at 04:36, Martin Blais <bl...@furius.ca> wrote:
> On Sun, Aug 20, 2017 at 12:09 AM, Ken Mankoff <man...@gmail.com> wrote:
>
>>
>> On 2017-08-19 at 21:54, Martin Blais <bl...@furius.ca> wrote:
>> > It looks like you're hitting a TypeError on sorting. This should not
>> > happen. (I suspect something to do with renaming your 5 account types,
>> > yet this should never happen.)
>>
>> After bisecting the file I discovered that this is causing the error:
>>
>> 2017-08-10 pad Assets:Cash:DKK Expenses:Food:Restaurants
>> 2017-08-11 balance Assets:Cash:DKK 1130 DKK
>>
>> Is this incorrect syntax? "bean-check" reports no errors.
>>
>
> This is correct syntax.
> This alone, by itself, does not generate the error.
> Could you
> 1. copy your file
> 2. remove bits and pieces, check the error still exists
> 3. repeat 2 as much as possible
> 4. share a minimal file, possibly removing private infos / changing numbers?
> That would be very useful in figuring out where this bug comes from.
>
>
>
>
>
>>
>> -k.
>>
>> --
>> 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+...@googlegroups.com.

Martin Blais

unread,
Aug 20, 2017, 1:56:57 AM8/20/17
to Beancount
On Sun, Aug 20, 2017 at 1:37 AM, Ken Mankoff <man...@gmail.com> wrote:
An MWE:

2007-01-01 open Assets:Cash:DKK                DKK
2007-01-01 open Expenses:Food:Restaurants      DKK,USD
2017-08-10 pad Assets:Cash:DKK  Expenses:Food:Restaurants
2017-08-11 balance Assets:Cash:DKK        1130 DKK

Seems to be the "DKK,USD". I know you advise to keep each account as its own currency, but we live/work in two countries (and travel in others) and it just makes sense to have one restaurant budget and not sub-budgets by currency. Maybe I'm missing something here in the bookkeeping/finance/organization logic?

No, that should be fine.
I do the same thing.
For expenses accounts it makes sense.

I'm able to bake this example to HTML without generating errors.



 

  -k.



On 2017-08-20 at 04:36, Martin Blais <bl...@furius.ca> wrote:
> On Sun, Aug 20, 2017 at 12:09 AM, Ken Mankoff <man...@gmail.com> wrote:
>
>>
>> On 2017-08-19 at 21:54, Martin Blais <bl...@furius.ca> wrote:
>> > It looks like you're hitting a TypeError on sorting. This should not
>> > happen. (I suspect something to do with renaming your 5 account types,
>> > yet this should never happen.)
>>
>> After bisecting the file I discovered that this is causing the error:
>>
>> 2017-08-10 pad Assets:Cash:DKK  Expenses:Food:Restaurants
>> 2017-08-11 balance Assets:Cash:DKK                     1130 DKK
>>
>> Is this incorrect syntax? "bean-check" reports no errors.
>>
>
> This is correct syntax.
> This alone, by itself, does not generate the error.
> Could you
> 1. copy your file
> 2. remove bits and pieces, check the error still exists
> 3. repeat 2 as much as possible
> 4. share a minimal file, possibly removing private infos / changing numbers?
> That would be very useful in figuring out where this bug comes from.
>
>
>
>
>
>>
>>   -k.
>>
>> --
>> 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

>> To post to this group, send email to bean...@googlegroups.com.
>> To view this discussion on the web visit https://groups.google.com/d/
>> msgid/beancount/m2efs62843.fsf%40gmail.com.
>> 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 beancount+unsubscribe@googlegroups.com.

To post to this group, send email to bean...@googlegroups.com.

Ken Mankoff

unread,
Aug 20, 2017, 2:24:29 AM8/20/17
to bean...@googlegroups.com

On 2017-08-20 at 05:56, Martin Blais <bl...@furius.ca> wrote:
> On Sun, Aug 20, 2017 at 1:37 AM, Ken Mankoff <man...@gmail.com> wrote:
>> 2007-01-01 open Assets:Cash:DKK DKK
>> 2007-01-01 open Expenses:Food:Restaurants DKK,USD
>> 2017-08-10 pad Assets:Cash:DKK Expenses:Food:Restaurants
>> 2017-08-11 balance Assets:Cash:DKK 1130 DKK
>>
> I'm able to bake this example to HTML without generating errors.

That is my entire bc.org file and it crashes on my system. How do I found out what beancount version I'm using?

$ python
>>> import beancount
>>> print(beancount.sys.api_version)
1013

pip search beancount
beancount (2.0rc1) - Command-line Double-Entry Accounting
INSTALLED: 2.0rc1 (latest)

-k.

Martin Blais

unread,
Aug 21, 2017, 1:08:14 AM8/21/17
to Beancount
Beancount is not really versioned.
I promised to switch to versions at some point but I've been wanting to convert all my docs before doing that and I haven't had the time.
Install from head, it's stable (loads of unit tests).





 

  -k.

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to bean...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages