Implementing pdfkit and wkhtmltopdf on windows fails
Dave Angel
davea at davea.name
Fri Oct 31 13:02:01 EDT 2014
On 10/31/2014 12:46 PM, robert brook wrote:
> I am able to install both of these packages on my mac at home and it works well.
>
> 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
>>>> path='C:\\wkhtmltopdf\\bin\\'
>>>> os.chdir(path)
>>>> 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>
> File "C:\Applications\python_33_32_bit\lib\site-packages\pdfkit-0.4.1-py3.3.eg
> g\pdfkit\api.py", line 66, in from_string
> File "C:\Applications\python_33_32_bit\lib\site-packages\pdfkit-0.4.1-py3.3.eg
> g\pdfkit\pdfkit.py", line 39, in __init__
> File "C:\Applications\python_33_32_bit\lib\site-packages\pdfkit-0.4.1-py3.3.eg
> 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 please
> install wkhtmltopdf - https://github.com/JazzCore/python-pdfkit/wiki/Installing
> -wkhtmltopdf
>
> **********************
>
I don't know your particular module, but generally, you want modules
installed on your sys.path. Either install it there, or add the
directory to sys.path (which is a list)
I'd suggest doing the latter, then figure whether a reinstall is called
for. It looks like you installed it in the root directory of C:, rather
than in the site-packages.
--
DaveA
More information about the Python-list
mailing list