Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runoob2pdf 里面的报错 OSError: No wkhtmltopdf executable found: "b''" #20

Open
pendave opened this issue May 20, 2017 · 3 comments

Comments

@pendave
Copy link

pendave commented May 20, 2017

OSError: No wkhtmltopdf executable found: "b''"

那个报错
我环境变量里加的是 D:\Program Files\wkhtmltopdf\bin\
以为是\b这个在python里解析出错的造成的,于是去改成 D:\\Program Files\\wkhtmltopdf\\bin\\ 还是不行。
我参考了老外的问答
http://stackoverflow.com/questions/27673870/cant-create-pdf-using-python-pdfkit-error-no-wkhtmltopdf-executable-found
改成

config = pdfkit.configuration(wkhtmltopdf=r"D:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe")
pdfkit.from_file(htmls, file_name, options=options, configuration=config)

就可以正常运行了

请问只能这样处理吗?

@pendave
Copy link
Author

pendave commented May 20, 2017

为毛我看了这里的解决方法 改成 D:/Program Files/wkhtmltopdf/bin/

I found the solution, I don't know why but python was replacing my environment path "C:\Program Files\wkhtmltopdf\bin" with "C:\Program Files\wkhtmltopdin" because of "\b" so I just replaced "\b" with "/b" and solved.

http://stackoverflow.com/questions/41631479/python-pdfkit-cant-find-wkhtmltopdf-executable
还搞不对?

@pendave
Copy link
Author

pendave commented May 20, 2017

red 083ft r 94chyw p8j

我问的是这里怎么改? 避免 \b

PATH 环境变量里设置的路径里有 \bin 或者 \b

D:\Program Files\wkhtmltopdf\bin\

老外说

Make sure that you have wkhtmltopdf in your PATH. where wkhtmltopdf in Windows or which wkhtmltopdf on Linux should return actual path to binary.

被处理成了二进制的

那这个环境变量怎么写才对呢?

@fujunguo
Copy link

我也是用下面这段代码才成功解决问题,一直改环境变量也没用,一直提示错误...
config = pdfkit.configuration(wkhtmltopdf=r"D:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe") pdfkit.from_file(htmls, file_name, options=options, configuration=config)

不知是否还有其他方法呢?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants