fuergaosi233 / gitbook2pdf

Grab the contents of the gitbook document and convert it to pdf
1.04k stars 175 forks source link

抓取示例页后生成 pdf 时在 ‘make_box’ 处报错 'NoneType' object is not subscriptable #103

Open intp1 opened 2 years ago

intp1 commented 2 years ago

(venv3) PS D:\gitbook2pdf-master> python3 gitbook.py http://self-publishin crawling : http://self-publishing.ebookchain.org/index.html crawling : http://self-publishing.ebookchain.org/1-干嘛要写书?/1-写书的必要性/readme.html crawling : http://self-publishing.ebookchain.org/1-干嘛要写书?/2-写书的好处/readme.html crawling : http://self-publishing.ebookchain.org/2-什么是自出版平台?/readme.html crawling : http://self-publishing.ebookchain.org/3-如何打造自己的平台?/readme.html crawling : http://self-publishing.ebookchain.org/3-如何打造自己的平台?/1-Summary的安装.html crawling : http://self-publishing.ebookchain.org/3-如何打造自己的平台?/2-Summary的使用.html crawling : http://self-publishing.ebookchain.org/3-如何打造自己的平台?/3-电子书的生成.html crawling : http://self-publishing.ebookchain.org/3-如何打造自己的平台?/4-电子书的发布.html crawling : http://self-publishing.ebookchain.org/4-最佳实践/妙手偶得无须刻意.html crawling : http://self-publishing.ebookchain.org/5-附录/0-参考信息.html crawling : http://self-publishing.ebookchain.org/5-附录/1-关于作者.html done : http://self-publishing.ebookchain.org/3-如何打造自己的平台?/2-Summary的使用.html done : http://self-publishing.ebookchain.org/4-最佳实践/妙手偶得无须刻意.html done : http://self-publishing.ebookchain.org/3-如何打造自己的平台?/3-电子书的生成.html done : http://self-publishing.ebookchain.org/5-附录/0-参考信息.html done : http://self-publishing.ebookchain.org/3-如何打造自己的平台?/1-Summary的安装.html done : http://self-publishing.ebookchain.org/1-干嘛要写书?/2-写书的好处/readme.html done : http://self-publishing.ebookchain.org/3-如何打造自己的平台?/readme.html done : http://self-publishing.ebookchain.org/3-如何打造自己的平台?/4-电子书的发布.html done : http://self-publishing.ebookchain.org/2-什么是自出版平台?/readme.html done : http://self-publishing.ebookchain.org/5-附录/1-关于作者.html done : http://self-publishing.ebookchain.org/index.html done : http://self-publishing.ebookchain.org/1-干嘛要写书?/1-写书的必要性/readme.html crawl : all done! Generating pdf,please wait patiently Traceback (most recent call last): File "D:\User\Documents\codes\gitbook\gitbook2pdf-master\gitbook.py", line 5, in Gitbook2PDF(url).run() File "D:\User\Documents\codes\gitbook\gitbook2pdf-master\gitbook2pdf\gitbook2pdf.py", line 211, in ru self.write_pdf(self.fname, html_text, css_text) File "D:\User\Documents\codes\gitbook\gitbook2pdf-master\gitbook2pdf\gitbook2pdf.py", line 255, in wr tmphtml.write_pdf(fname, stylesheets=[tmpcss]) File "C:\Users\Administrator\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p self.render( File "C:\Users\Administrator\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p return Document._render( File "C:\Users\Administrator\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p root_box = build_formatting_structure( File "C:\Users\Administrator\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8pformatting_structure box_list = element_to_box( File "C:\Users\Administrator\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8pnt_to_box child_boxes = element_to_box( File "C:\Users\Administrator\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\PythoalCache\local-packages\Python310\site-packages\weasyprint\formattingstructure\build.py", line 190, in elemeto nt_to_box child_boxes = element_to_box( ache\local-packages\Pytho File "C:\Users\Administrator\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalC alCache\local-packages\Python310\site-packages\weasyprint\formatting_structure\build.py", line 190, in elemeto_nt_to_box child_boxes = element_to_box( ache\local-packages\Pytho [Previous line repeated 1 more time]
File "C:\Users\Administrator\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCalCache\local-packages\Python310\site-packages\weasyprint\formatting_structure\build.py", line 170, in elemeto_ache\local-packages\Pythont_to_box
marker_boxes = list(marker_to_box( File "C:\Users\Administrator\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\PythoalCache\local-packages\Python310\site-packages\weasyprint\formatting_structure\build.py", line 325, in markeo_br_to_box box = make_box(f'{element.tag}::marker', style, children, element) File "C:\Users\Administrator\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCalCache\local-packages\Python310\site-packages\weasyprint\formatting_structure\build.py", line 95, in make_box box = BOX_TYPE_FROM_DISPLAY[style['display'][:2]]( TypeError: 'NoneType' object is not subscriptable

DHJDYJ commented 2 years ago

http://cache.baiducontent.com/c?m=Q9gCN0cNDcRm7iCzFwwk5T7Esaj_XoSmcT_1boivQCnd0sIIHHTOWQzjdYFTIECYg8jQS3hL7Tx6GQrKMgvWMXii50Xn2thHR1e2dW7W6ZQiUqj81Zoqt-EFQ_Kt8JF6caD_CLiS6SJkZbmc0Fh0Va&p=882a9646908610fc57ef8a261e0a&newp=83769a4786cc42ac17b9d5314f5e92695803ed633dd3da01298ffe0cc4241a1a1a3aecbe25271403d3c6796003a84b58eaf63670310834f1f689df08d2ecce7e&s=9a1158154dfa42ca&user=baidu&fm=sc&query=weasyprint+%27NoneType%27&qid=bb92903a0002b420&p1=3

我也是这个问题,试了pip install weasyprint==43rc1之后成功的