Issue
Trying to export a webpage as pdf in Eclipse or Spyder, I can successfully run the following script in the Mac terminal:
import pdfkit
import wkhtmltopdf
pdfkit.from_url('http://google.com', 'out.pdf')
But, this script does not work in either Eclipse PyDev or Anaconda Spyder giving the following error:
IOError: No wkhtmltopdf executable found: "" 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 ERROR: Module: xxxx could not be imported (file: /Users/MyMac/Documents/myproject/mwe.py).
Note that I am using Python 2.7 and it seems wkhtmltopdf does not work properly in Python 3.* Also, I have added wkhtmltopdf's folder to PYTHONPATH.
Solution
You need to add the ..\wkhtmltopdf\bin
to your PYTHONPATH.
In Eclipse go to project -> properties -> PyDev-PYTHONPATH and at the register External Libraries add your source folder (full path to ..\wkhtmltopdf\bin
).
Answered By - Arrow
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.