kxxoling / markdown2pdf

[Deprecated] A command line tool to convert markdown file to pdf.
https://pypi.python.org/pypi/Markdown2PDF
63 stars 23 forks source link

Facing TypeError while converting Markdown to PDF #11

Closed KiranPesarlanka closed 4 years ago

KiranPesarlanka commented 6 years ago
kirans-thinkpad:~/Downloads$ sudo pip install markdown2pdf
The directory '/home/kiran/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/kiran/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: markdown2pdf in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied: weasyprint in /usr/local/lib/python2.7/dist-packages (from markdown2pdf)
Requirement already satisfied: markdown2 in /usr/local/lib/python2.7/dist-packages (from markdown2pdf)
Requirement already satisfied: cffi>=0.6 in /home/deepcompute/.local/lib/python2.7/site-packages (from weasyprint->markdown2pdf)
Requirement already satisfied: CairoSVG<2.0.0,>=1.0.20; python_version < "3.0" in /usr/local/lib/python2.7/dist-packages (from weasyprint->markdown2pdf)
Requirement already satisfied: Pyphen>=0.8 in /usr/local/lib/python2.7/dist-packages (from weasyprint->markdown2pdf)
Requirement already satisfied: cssselect2>=0.1 in /usr/local/lib/python2.7/dist-packages (from weasyprint->markdown2pdf)
Requirement already satisfied: tinycss2>=0.5 in /usr/local/lib/python2.7/dist-packages (from weasyprint->markdown2pdf)
Requirement already satisfied: pdfrw>=0.4 in /usr/local/lib/python2.7/dist-packages (from weasyprint->markdown2pdf)
Requirement already satisfied: html5lib>=0.999999999 in /usr/local/lib/python2.7/dist-packages (from weasyprint->markdown2pdf)
Requirement already satisfied: cairocffi>=0.5 in /usr/local/lib/python2.7/dist-packages (from weasyprint->markdown2pdf)
Requirement already satisfied: pycparser in /home/deepcompute/.local/lib/python2.7/site-packages (from cffi>=0.6->weasyprint->markdown2pdf)
Requirement already satisfied: webencodings>=0.4 in /usr/local/lib/python2.7/dist-packages (from tinycss2>=0.5->weasyprint->markdown2pdf)
Requirement already satisfied: six>=1.9 in /usr/local/lib/python2.7/dist-packages (from html5lib>=0.999999999->weasyprint->markdown2pdf)
kirans-thinkpad:~/Downloads$ md2pdf README.md 
Traceback (most recent call last):
  File "/usr/local/bin/md2pdf", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/markdown2pdf/__init__.py", line 33, in main
    convert_md_2_pdf(**dict(args._get_kwargs()))
  File "/usr/local/lib/python2.7/dist-packages/markdown2pdf/__init__.py", line 23, in convert_md_2_pdf
    HTML(string=html).write_pdf(output)
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/__init__.py", line 182, in write_pdf
    font_config=font_config).write_pdf(
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/__init__.py", line 143, in render
    font_config)
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/document.py", line 326, in _render
    [Page(p, enable_hinting) for p in page_boxes],
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/layout/__init__.py", line 55, in layout_document
    context, root_box, html, cascaded_styles, computed_styles))
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/layout/pages.py", line 601, in make_all_pages
    context, root_box, page_type, resume_at, page_number)
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/layout/pages.py", line 520, in make_page
    positioned_boxes, positioned_boxes, adjoining_margins)
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/layout/blocks.py", line 83, in block_level_layout
    adjoining_margins)
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/layout/blocks.py", line 111, in block_box_layout
    page_is_empty, absolute_boxes, fixed_boxes, adjoining_margins)
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/layout/blocks.py", line 638, in block_container_layout
    adjoining_margins)
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/layout/blocks.py", line 83, in block_level_layout
    adjoining_margins)
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/layout/blocks.py", line 111, in block_box_layout
    page_is_empty, absolute_boxes, fixed_boxes, adjoining_margins)
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/layout/blocks.py", line 638, in block_container_layout
    adjoining_margins)
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/layout/blocks.py", line 83, in block_level_layout
    adjoining_margins)
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/layout/blocks.py", line 111, in block_box_layout
    page_is_empty, absolute_boxes, fixed_boxes, adjoining_margins)
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/layout/blocks.py", line 510, in block_container_layout
    for line, resume_at in lines_iterator:
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/layout/inlines.py", line 51, in iter_line_boxes
    device_size, absolute_boxes, fixed_boxes, first_letter_style)
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/layout/inlines.py", line 108, in get_next_linebox
    waiting_floats, line_children=[])
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/layout/inlines.py", line 727, in split_inline_box
    line_placeholders, waiting_floats, line_children)
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/layout/inlines.py", line 600, in split_inline_level
    waiting_floats, line_children)
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/layout/inlines.py", line 727, in split_inline_box
    line_placeholders, waiting_floats, line_children)
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/layout/inlines.py", line 600, in split_inline_level
    waiting_floats, line_children)
  File "/usr/local/lib/python2.7/dist-packages/weasyprint/layout/inlines.py", line 839, in split_inline_box
    child_resume_at[0] + current_skip,
TypeError: 'NoneType' object has no attribute '__getitem__'
kxxoling commented 6 years ago

Seems it's an error while weasyprint is trying to render PDF. What does your README.md looks like?