bean-bake fails (Windows bash)

74 views
Skip to first unread message

short...@gmail.com

unread,
Jun 25, 2017, 8:45:11 AM6/25/17
to Beancount
Using Windows bash, bean-bake fails to bake:

127.0.0.1 - - [25/Jun/2017 22:43:02] "GET / HTTP/1.1" 303 0
ERROR  
: Redirected: / -> /index
127.0.0.1 - - [25/Jun/2017 22:43:02] "GET /index HTTP/1.1" 200 6658
INFO    
: Operation: 'realize_opening'                                Time:      0 ms
INFO    
: Operation: 'realize'                                        Time:      1 ms
INFO    
: Operation: 'realize_closing'                                Time:      1 ms
127.0.0.1 - - [25/Jun/2017 22:43:02] "GET /view/tag/trip-chicago-2016/balsheet HTTP/1.1" 200 5128
127.0.0.1 - - [25/Jun/2017 22:43:02] "GET /view/tag/trip-chicago-2016/journal/Equity:Earnings:Current HTTP/1.1" 200 7482
Traceback (most recent call last):
 
File "/usr/local/bin/bean-bake", line 4, in <module>
   
from beancount.scripts.bake import main; main()
 
File "/usr/local/lib/python3.5/dist-packages/beancount/scripts/bake.py", line 247, in main
    bake_to_directory
(opts, output_directory, opts.quiet, opts.full_mode)
 
File "/usr/local/lib/python3.5/dist-packages/beancount/scripts/bake.py", line 153, in bake_to_directory
    quiet
)
 
File "/usr/local/lib/python3.5/dist-packages/beancount/web/web.py", line 1234, in scrape_webapp
    url_lists
= scrape.scrape_urls(url_format, callback, ignore_regexp)
 
File "/usr/local/lib/python3.5/dist-packages/beancount/web/scrape.py", line 114, in scrape_urls
    callback
(url, response, response_contents, html_root, skipped_urls)
 
File "/usr/local/lib/python3.5/dist-packages/beancount/scripts/bake.py", line 116, in save_scraped_document
   
with open(output_filename, 'wb') as outfile:
OSError: [Errno 22] Invalid argument: 'example/view/tag/trip-chicago-2016/journal/Equity:Earnings:Current.html'


Is this because Windows does not allow colons in file names?

If so, can this be fixed so, say, the dots are used instead?

S.

Martin Blais

unread,
Jun 25, 2017, 12:22:17 PM6/25/17
to Beancount
Might be. I thought this used to work. It's probably that. I have no way to test.

The most optimal way to fix this (and likely many other problems with computers in general) is to stop running Windows.

Barring this freedom, you can hg update now, I just added an option for you to replace the colon separator in filenames by something else (--no-colons). Try this out and let me know if it works.






--
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/45df2138-b6d9-4d9b-a2be-9632f6601afb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

short...@gmail.com

unread,
Aug 6, 2017, 7:33:34 AM8/6/17
to Beancount


On Monday, June 26, 2017 at 2:22:17 AM UTC+10, Martin Blais wrote:

Barring this freedom, you can hg update now, I just added an option for you to replace the colon separator in filenames by something else (--no-colons). Try this out and let me know if it works.
 
Thanks for this, and sorry for the late reply - I was away. The error stays exactly the same.

Looking in the diffs, from what I can gather - I'm not a Python coder - I think you're changes (i.e. added no-colons option) are not picked up because you are not passing the --no-colons argument when starting the server in bake_to_directory(). I.e. the web.scrape_webapp() at line 149 of bake.py should have extra web args passed:

processed_urls, skipped_urls = web.scrape_webapp(webargs.filename,
                                                     callback,
                                                     webargs.port,
                                                     ignore_regexps,
                                                     quiet, extra_args)

I think those extra arguments should be built by checking if --no-colons, --view and --first-month parameters are present. --first-month is of interest to me because Australian financial year starts in July.

I'd appreciate if you can add this - I'm unsure how to do it myself.

Cheers,
S.

Martin Blais

unread,
Aug 7, 2017, 12:12:32 AM8/7/17
to Beancount
Spot on.
Apologies for the sloppy fix, I should have done better testing.
Fixed now.

(I think this code needs review anyhow, all the options should be read and processed in a single place. How these options are passed around has grown a bit hacky in order to retrofit this "bake" feature and it needs a bit of care.)



Cheers,
S.

--
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.

mpl...@gmail.com

unread,
Nov 19, 2018, 10:10:09 PM11/19/18
to Beancount
Have same issue, using "--no-colons" solved it partially, some of the pages/links are not being generated/not working.

Here is log with errors:
K:\at\office>bean-bake --no-colons at.beancount test
Bottle v0.12.13 server starting up (using WSGIRefServer())...
Listening on http://localhost:9475/
Hit Ctrl-C to quit.

INFO    
: Reloading...
127.0.0.1 - - [19/Nov/2018 21:45:19] "GET / HTTP/1.1" 303 0

ERROR  
: Redirected: / -> /index
127.0.0.1 - - [19/Nov/2018 21:45:20] "GET /index HTTP/1.1" 200 5459
INFO    
: Operation: 'clamp'                                          Time:      3 ms
INFO    
: Operation: 'realize_opening'                                Time:      0 ms
INFO    
: Operation: 'realize'                                        Time:      3 ms
INFO    
: Operation: 'realize_closing'                                Time:      2 ms
127.0.0.1 - - [19/Nov/2018 21:45:21] "GET /view/year/2017/balsheet HTTP/1.1" 200 5464
127.0.0.1 - - [19/Nov/2018 21:45:22] "GET /view/year/2017/journal/Equity__Opening-Balances HTTP/1.1" 200 7765
127.0.0.1 - - [19/Nov/2018 21:45:23] "GET /view/year/2017/journal/Equity__Earnings__Current HTTP/1.1" 200 29585
....
127.0.0.1 - - [19/Nov/2018 21:46:03] "GET /view/year/2017/conversions HTTP/1.1" 200 2139
127.0.0.1 - - [19/Nov/2018 21:46:04] "GET /view/year/2017/openbal HTTP/1.1" 200 3768
127.0.0.1 - - [19/Nov/2018 21:46:05] "GET /view/year/2017/journal/all HTTP/1.1" 303 0
ERROR  
: Redirected: /view/year/2017/journal/all -> /view/year/2017/journal/
127.0.0.1 - - [19/Nov/2018 21:46:06] "GET /view/year/2017/journal/ HTTP/1.1" 200 330073
127.0.0.1 - - [19/Nov/2018 21:46:08] "GET /view/year/2017/journal/Income__Rewards HTTP/1.1" 200 2690
127.0.0.1 - - [19/Nov/2018 21:46:09] "GET /view/year/2017/journal/Expenses__Personal__Books HTTP/1.1" 200 2735
....
127.0.0.1 - - [19/Nov/2018 21:46:36] "GET /view/year/2017/equity/holdings HTTP/1.1" 200 2926
127.0.0.1 - - [19/Nov/2018 21:46:37] "GET /view/year/2017/income HTTP/1.1" 200 7158
INFO    
: Operation: 'clamp'                                          Time:      0 ms
INFO    
: Operation: 'realize_opening'                                Time:      0 ms
INFO    
: Operation: 'realize'                                        Time:     16 ms
INFO    
: Operation: 'realize_closing'                                Time:      7 ms
127.0.0.1 - - [19/Nov/2018 21:46:38] "GET /view/year/2018/balsheet HTTP/1.1" 200 5942
127.0.0.1 - - [19/Nov/2018 21:46:39] "GET /view/year/2018/journal/Equity__Opening-Balances HTTP/1.1" 200 12922
....
127.0.0.1 - - [19/Nov/2018 21:49:23] "GET /errors HTTP/1.1" 200 1350
127.0.0.1 - - [19/Nov/2018 21:49:24] "GET /resources/web.css HTTP/1.1" 200 5034
INFO    
: Validating HTML output files & links.
INFO    
: Validating: 'test\errors.html'
INFO    
: Validating: 'test\index.html'
INFO    
: Validating: 'test\source.html'
....
I
NFO    : Validating: 'test\view\year\2018\journal\Liabilities__AMEX.html'
INFO    
: Validating: 'test\view\year\2018\journal\Liabilities__InkBCash.html'
INFO    
: Validation: 226 files processed
ERROR  
: Validation error: Missing 'test\view\year\2018\journal\..%5Cbalsheet.html'
ERROR  
: Validation error: Missing 'test\view\year\2018\journal\..%5Cincome.html'
ERROR  
: Validation error: Missing 'test\view\year\2018\journal\..%5Cindex.html'
ERROR  
: Validation error: Missing 'test\view\year\2018\journal\..%5Cequity%5Choldings.html'
ERROR  
: Validation error: Missing 'test\view\year\2018\journal\..%5Ctrial.html'
ERROR  
: Validation error: Missing 'test\view\year\2018\journal\..%5C..%5C..%5C..%5Cindex.html'
ERROR  
: Validation error: Missing 'test\view\year\2018\journal\..%5C..%5C..%5C..%5Cresources%5Cweb.css'
Output in 'test'


mpl...@gmail.com

unread,
Nov 26, 2018, 8:59:33 AM11/26/18
to Beancount
Guys hi,

Still trying to solve this, will appreciate any suggestions on why balsheet.html, income.html, index.html... and web.css are not generated.

Might be encoding problem related to "%5C", but not sure.

mpl...@gmail.com

unread,
Nov 26, 2018, 5:54:48 PM11/26/18
to Beancount
Update:

bean-bake --no-colons myledger.beancount 181126
works correctly on cygwin, but on direct windows installation it produces links with backward slashes.

For example
file:///c:/myledger/office/181126/view\year\2018\balsheet.html


Instead of
file:///c:/myledger/office/181126/view/year/2018/balsheet.html
Reply all
Reply to author
Forward
0 new messages