3

I'm trying to make PDFs out of HTML files and URLs. I've found wkhtmltopdf to be just what I'm looking for, and the Python wrapper, pdfkit, seems great too.

However, when I try to run the basic script:

import pdfkit
pdfkit.from_url('http://google.com', 'out.pdf')

In either Wing IDE or Sublime Text 2, I get this error:

AttributeError: 'module' object has no attribute 'from_url'

The strange part is, it works fine when I do it at the command line or in the Wing IDE shell.

I assume this has something to do with how pdfkit is installed in sitepackages, but I don't know enough about the intricacies of those to figure out how to fix the issue. Can anyone help?

I'm using Python 2.7, Wing IDE 4.1.11-1, Sublime Text 2.0.2 on Windows 7.

Thanks a lot, Alex

4

1 回答 1

2

正如 Wingware 指出的那样,我在与脚本相同的文件夹中有一个名为 pdfkit.py 的文件。它没有导入模块,而是导入了该文件,该文件当然几乎是空的。

谢谢翼件。

于 2015-04-13T20:11:28.087 回答