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

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

python html如何轉成PDF?

瀏覽:142日期: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 編程
相關文章:
主站蜘蛛池模板: 福州市| 绥滨县| 平陆县| 广安市| 镇宁| 丰城市| 连云港市| 思茅市| 浏阳市| 阿巴嘎旗| 罗平县| 偃师市| 博乐市| 修武县| 定结县| 沛县| 阳新县| 牟定县| 高碑店市| 潍坊市| 洪江市| 湘乡市| 封丘县| 天门市| 兴业县| 德江县| 石屏县| 师宗县| 潢川县| 恩平市| 徐州市| 北票市| 二手房| 华池县| 冕宁县| 淮南市| 南皮县| 宝兴县| 平阳县| 九寨沟县| 丽水市|