久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術文章
文章詳情頁

python html如何轉成PDF?

瀏覽:136日期:2022-08-07 13:35:50

問題描述

import pdfkitpdfkit.from_url(’http://www.cocoachina.com/’, ’out.pdf’)

老報錯我已經安裝了wkhtmltopdf :還請大神幫忙解決!

還有如何將wkhtmltopdf的執行路徑添加到系統環境$PATH變量中?

Traceback (most recent call last): File '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pdfkit/configuration.py', line 21, in __init__ with open(self.wkhtmltopdf) as f:FileNotFoundError: [Errno 2] No such file or directory: b’’During handling of the above exception, another exception occurred:Traceback (most recent call last): File '/Users/peibobo/PycharmProjects/bottle/pdf_test.py', line 3, in <module> pdfkit.from_url(’http://www.cocoachina.com/’, ’out.pdf’) File '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pdfkit/api.py', line 24, in from_url configuration=configuration, cover_first=cover_first) File '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pdfkit/pdfkit.py', line 42, in __init__ self.configuration = (Configuration() if configuration is None File '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pdfkit/configuration.py', line 27, in __init__ ’https://github.com/JazzCore/python-pdfkit/wiki/Installing-wkhtmltopdf’ % self.wkhtmltopdf)OSError: No wkhtmltopdf executable found: 'b’’'If this file exists please check that this process can read it. Otherwise please install wkhtmltopdf - https://github.com/JazzCore/python-pdfkit/wiki/Installing-wkhtmltopdf

問題解答

回答1:

首先是你21行這句錯誤with open(self.wkhtmltopdf) as f:

應該是self.wkhtmltopdf為空字符串,沒有可以打開的文件

標簽: Python 編程
相關文章:
主站蜘蛛池模板: 桐城市| 斗六市| 开江县| 开鲁县| 南康市| 宜丰县| 综艺| 故城县| 高陵县| 图片| 梁平县| 来凤县| 阜阳市| 宁晋县| 西贡区| 湖北省| 车致| 察雅县| 广平县| 济南市| 子长县| 白沙| 弋阳县| 宁津县| 林芝县| 潼关县| 凤庆县| 大关县| 莎车县| 正宁县| 荃湾区| 威信县| 道孚县| 泸水县| 桐柏县| 舟山市| 昌图县| 昌宁县| 都昌县| 泾源县| 荥经县|