2016-07-20 7 views
2
Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
[GCC 4.8.2] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
>>> from weasyprint import HTML 
>>> HTML('http://weasyprint.org/').write_pdf('/tmp/weasyprint-website.pdf') 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "/usr/local/lib/python2.7/dist-packages/weasyprint/__init__.py", line 94, in __init__ 
    namespaceHTMLElements=False) 
TypeError: parse() got an unexpected keyword argument 'override_encoding' 
>>> 

私はすべての依存関係をインストールしていると思います。ここで何が起こっているのですか?TypeError:parse()は予期しないキーワード引数 'override_encoding'を持っています

答えて

0

ファイルを開く:/usr/local/lib/python2.7/dist-packages/weasyprint/ のinitの.py

変更このコード:これに

result = html5lib.parse(
        source, treebuilder='lxml', override_encoding=encoding, 
        transport_encoding=protocol_encoding, 
        namespaceHTMLElements=False) 

result = html5lib.parse(
        source, treebuilder='lxml' 
       ) 

OS Xで動作します。エルキャピタン10.11.6(15G31)

0

これはhttps://github.com/Kozea/WeasyPrint/issues/353と同じ問題があるようです。

古くなったのはhtml5libである可能性があります。少なくともhtml5lib-1.0b9である必要があります。 html5libをインストールする場合はpipとなりますが、まだhtml5lib-1.0b8になる可能性があります。このように更新することをおすすめします。

pip install --pre html5lib 
関連する問題