Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #80043

Re: Implementing pdfkit and wkhtmltopdf on windows fails

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'explicitly': 0.05; '"""': 0.07; 'binary': 0.07; 'skip:" 60': 0.07; 'variables': 0.07; '__init__': 0.09; 'executable': 0.09; 'newly': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'url:archive': 0.09; 'url:github': 0.09; 'window.': 0.09; 'python': 0.11; 'windows': 0.15; '#this': 0.16; '39,': 0.16; '66,': 0.16; 'exe': 0.16; 'fails.': 0.16; 'modules,': 0.16; 'path.': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'spit': 0.16; 'subject:fails': 0.16; 'subject:windows': 0.16; 'sys.path': 0.16; 'windows:': 0.16; 'folder': 0.16; 'wrote:': 0.18; 'trying': 0.19; "python's": 0.19; 'entered': 0.20; 'import': 0.22; 'rules': 0.22; 'shell': 0.22; 'install': 0.23; 'installation': 0.23; 'header:User-Agent:1': 0.23; 'error': 0.23; 'exists': 0.24; 'specifies': 0.24; 'specify': 0.24; 'fine': 0.24; 'looks': 0.24; 'environment': 0.24; 'script': 0.25; 'header:X -Complaints-To:1': 0.27; 'instruction': 0.29; 'robert': 0.30; 'url:wiki': 0.31; '"",': 0.31; '>>>>': 0.31; 'loading': 0.31; 'os,': 0.31; 'file': 0.32; '(most': 0.33; 'mac': 0.33; '"the': 0.34; 'add': 0.35; 'should': 0.36; 'list': 0.37; 'to:addr:python- list': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'received:org': 0.40; 'according': 0.40; 'read': 0.60; 'subject: ': 0.61; 'full': 0.61; 'skip:* 10': 0.61; 'home': 0.69; 'installer': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Peter Otten <__peter__@web.de>
Subject Re: Implementing pdfkit and wkhtmltopdf on windows fails
Date Fri, 31 Oct 2014 18:45 +0100
Organization None
References <ff33a03e-8b6a-427d-b4ea-c267a768cb15@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Gmane-NNTP-Posting-Host p57bda2c1.dip0.t-ipconnect.de
User-Agent KNode/4.13.3
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.15365.1414777515.18130.python-list@python.org> (permalink)
Lines 62
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1414777515 news.xs4all.nl 2904 [2001:888:2000:d::a6]:43719
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:80043

Show key headers only | View raw


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
> 
> **********************

Following the link in the traceback I find the installation instruction for 
windows:

"""
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.

http://geekswithblogs.net/renso/archive/2009/10/21/how-to-set-the-windows-path-in-windows-7.aspx

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.

Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Implementing pdfkit and  wkhtmltopdf on windows fails robert brook <software.by.python@gmail.com> - 2014-10-31 09:46 -0700
  Re: Implementing pdfkit and  wkhtmltopdf on windows fails Dave Angel <davea@davea.name> - 2014-10-31 13:02 -0400
    Re: Implementing pdfkit and  wkhtmltopdf on windows fails robert brook <software.by.python@gmail.com> - 2014-10-31 10:25 -0700
  Re: Implementing pdfkit and  wkhtmltopdf on windows fails Peter Otten <__peter__@web.de> - 2014-10-31 18:45 +0100

csiph-web