dohsimpson / kubernetes-doc-pdf

Kubernetes PDF Documentation
282 stars 168 forks source link

IndexError: tuple index out of range #7

Closed zhangxingdeppon closed 4 years ago

zhangxingdeppon commented 4 years ago

hi, buddy, I met a problem, when I use this tool to transfor the website to pdf, a fatal error was happend, could you give me some advices? thanks, the details below:


ERROR: Failed to load image at "https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/reference/tools.md?pixel" (URLError: )
INFO: Step 5 - Creating layout - Page 1
INFO: Step 5 - Creating layout - Page 2
INFO: Step 5 - Creating layout - Page 3
INFO: Step 5 - Creating layout - Page 4
INFO: Step 5 - Creating layout - Page 5
INFO: Step 5 - Creating layout - Page 6
INFO: Step 5 - Creating layout - Page 7
INFO: Step 5 - Creating layout - Page 8
INFO: Step 5 - Creating layout - Page 9
INFO: Step 5 - Creating layout - Page 10
INFO: Step 5 - Creating layout - Page 11
INFO: Step 5 - Creating layout - Page 12
INFO: Step 5 - Creating layout - Page 13
Traceback (most recent call last):
  File "/usr/bin/weasyprint", line 8, in 
    sys.exit(main())
  File "/usr/lib/python3.6/site-packages/weasyprint/__main__.py", line 212, in main
    getattr(html, 'write_' + format_)(output, **kwargs)
  File "/usr/lib/python3.6/site-packages/weasyprint/__init__.py", line 211, in write_pdf
    font_config=font_config).write_pdf(
  File "/usr/lib/python3.6/site-packages/weasyprint/__init__.py", line 168, in render
    font_config)
  File "/usr/lib/python3.6/site-packages/weasyprint/document.py", line 393, in _render
    [Page(page_box, enable_hinting) for page_box in page_boxes],
  File "/usr/lib/python3.6/site-packages/weasyprint/document.py", line 393, in 
    [Page(page_box, enable_hinting) for page_box in page_boxes],
  File "/usr/lib/python3.6/site-packages/weasyprint/layout/__init__.py", line 126, in layout_document
    pages = list(make_all_pages(context, root_box, html, pages))
  File "/usr/lib/python3.6/site-packages/weasyprint/layout/pages.py", line 803, in make_all_pages
    page, resume_at = remake_page(i, context, root_box, html)
  File "/usr/lib/python3.6/site-packages/weasyprint/layout/pages.py", line 742, in remake_page
    page_number, page_state)
  File "/usr/lib/python3.6/site-packages/weasyprint/layout/pages.py", line 553, in make_page
    positioned_boxes, adjoining_margins)
  File "/usr/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 63, in block_level_layout
    page_is_empty, absolute_boxes, fixed_boxes, adjoining_margins)
  File "/usr/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 77, in block_level_layout_switch
    page_is_empty, absolute_boxes, fixed_boxes, adjoining_margins)
  File "/usr/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 130, in block_box_layout
    absolute_boxes, fixed_boxes, adjoining_margins)
  File "/usr/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 510, in block_container_layout
    absolute_boxes, fixed_boxes, adjoining_margins)
  File "/usr/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 63, in block_level_layout
    page_is_empty, absolute_boxes, fixed_boxes, adjoining_margins)
  File "/usr/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 77, in block_level_layout_switch
    page_is_empty, absolute_boxes, fixed_boxes, adjoining_margins)
  File "/usr/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 130, in block_box_layout
    absolute_boxes, fixed_boxes, adjoining_margins)
  File "/usr/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 510, in block_container_layout
    absolute_boxes, fixed_boxes, adjoining_margins)
  File "/usr/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 63, in block_level_layout
    page_is_empty, absolute_boxes, fixed_boxes, adjoining_margins)
  File "/usr/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 77, in block_level_layout_switch
    page_is_empty, absolute_boxes, fixed_boxes, adjoining_margins)
  File "/usr/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 130, in block_box_layout
    absolute_boxes, fixed_boxes, adjoining_margins)
  File "/usr/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 510, in block_container_layout
    absolute_boxes, fixed_boxes, adjoining_margins)
  File "/usr/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 63, in block_level_layout
    page_is_empty, absolute_boxes, fixed_boxes, adjoining_margins)
  File "/usr/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 77, in block_level_layout_switch
    page_is_empty, absolute_boxes, fixed_boxes, adjoining_margins)
  File "/usr/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 130, in block_box_layout
    absolute_boxes, fixed_boxes, adjoining_margins)
  File "/usr/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 376, in block_container_layout
    for line, resume_at in lines_iterator:
  File "/usr/lib/python3.6/site-packages/weasyprint/layout/inlines.py", line 53, in iter_line_boxes
    absolute_boxes, fixed_boxes, first_letter_style)
  File "/usr/lib/python3.6/site-packages/weasyprint/layout/inlines.py", line 70, in get_next_linebox
    skip_stack = skip_first_whitespace(linebox, skip_stack)
  File "/usr/lib/python3.6/site-packages/weasyprint/layout/inlines.py", line 210, in skip_first_whitespace
    result = skip_first_whitespace(box.children[index], next_skip_stack)
IndexError: tuple index out of range
+ docker rm -f weasy
            
dohsimpson commented 4 years ago

Looks like there were some changes in weasyprint between version 46 and version 50 that broke the library in our use case. I will pin weasyprint version to 46 and that will fix the issue.