Implementing pdfkit and wkhtmltopdf on windows fails
__peter__ at web.de
Fri Oct 31 18:45:00 CET 2014
robert brook wrote:
> I am able to install both of these packages on my mac at home and it works
> I am trying to install on windows 7 at work and it fails. PDFKit is
> trying to find the wkh package and it cannot. I have entered the full path
> to the exe for the environment variables and the error below is spit out.
> If I explicitly cd into the directory that has the executable the script
> works fine
>>>> import os
>>>> pdfkit.from_string('Hello!', 'out.pdf')
> Loading pages (1/6) #this works after cd into the exe directory
> Where can I specify the path to the executable?
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> g\pdfkit\api.py", line 66, in from_string
> g\pdfkit\pdfkit.py", line 39, in __init__
> g\pdfkit\configuration.py", line 27, in __init__
> OSError: No wkhtmltopdf executable found: "b''"
> If this file exists please check that this process can read it. Otherwise
> install wkhtmltopdf -
Following the link in the traceback I find the installation instruction for
Download the installer from the wkhtmltopdf downloads list and add folder
with wkhtmltopdf binary to PATH.
This PATH has nothing to do with Python's sys.path which specifies where
Python looks for modules, and you have to set it according to the rules of
your OS, e. g.
Once you have added "the directory you had to cd into" follwing the above
instructions your script should work in a newly opened shell window.
More information about the Python-list