B
B
blazer052017-07-15 13:24:21
Django
blazer05, 2017-07-15 13:24:21

weasyprint module error, how to fix?

windows 10 64bit, python 2.7.9, django 1.11.3
Installed this module for weasyprint pdf format, I can't run it all the time with an error on the production server. Locally, it also starts with an error, but it works, but it doesn’t work at all in combat mode.
Locally on startup it gives:

D:\OpenServer\domains\virtualenv\myshop\lib\site-packages\weasyprint\text.py:29: UserWarning: There are known rendering problems with Cairo <= 1.14.0
  warnings.warn('There are known rendering problems with Cairo <= 1.14.0')
D:\OpenServer\domains\virtualenv\myshop\lib\site-packages\weasyprint\fonts.py:44: UserWarning: @font-face is currently not supported on Windows
  warnings.warn('@font-face is currently not supported on Windows')
System check identified no issues (0 silenced).
July 15, 2017 - 13:05:30
Django version 1.11.2, using settings 'myshop.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
[15/Jul/2017 13:05:30] "GET / HTTP/1.1" 200 3046
[15/Jul/2017 13:05:40] "GET /admin/ HTTP/1.1" 200 8183
[15/Jul/2017 13:05:42] "GET /admin/orders/order/ HTTP/1.1" 200 10131
[15/Jul/2017 13:05:43] "GET /admin/jsi18n/ HTTP/1.1" 200 14962
[15/Jul/2017 13:05:46] "GET /order/admin/order/3/pdf/ HTTP/1.1" 200 58945
[15/Jul/2017 13:06:15] "GET /admin/orders/order/ HTTP/1.1" 200 10131

but at the same time, the module works and in the admin panel the link to the pdf document also works fine.
But when running on the production server, django crashes with an error
dlopen() failed to load a library: cairo / cairo-2
and
Exception Type: 	ImportError
Exception Value: 	cannot import name properties
Exception Location: 	D:\OpenServer\domains\virtualenv\myshop\Lib\site-packages\weasyprint\css\__init__.py in <module>, line 29
Python Executable: 	D:\openserver\modules\http\Apache-2.4\bin\httpd.exe

Who with such faced, help to start.
I did according to the instructions for the module , I also googled a lot and google brought me here where I downloaded and installed three modules pycairo, pygobject and pygtk 32bit versions. The 64bit module was not installed for me because of python2 it is 32bit.
I also installed this module on 32bit in Windows and PATH added the installation path C:\GTK\bin - still the same error. In the console I ran this command python -m weasyprint weasyprint.org weasyprint.pdf and I get an error
(myshop) PS C:\users\blazer\desktop> python -m weasyprint http://weasyprint.org weasyprint.pdf
D:\openserver\domains\virtualenv\myshop\lib\site-packages\weasyprint\text.py:29: UserWarning: There are known rendering problems with Cairo <= 1.14.0
  warnings.warn('There are known rendering problems with Cairo <= 1.14.0')
D:\openserver\domains\virtualenv\myshop\lib\site-packages\weasyprint\fonts.py:44: UserWarning: @font-face is currently not supported on Windows
  warnings.warn('@font-face is currently not supported on Windows')
WARNING: Ignored `transition: color 0.25s` at 14:18, unknown property.
WARNING: Ignored `text-shadow: 1px 1px 1px #111` at 18:125, unknown property.

(python.exe:5696): Pango-WARNING **: couldn't load font "Cousine Not-Rotated 12.9599609375px", falling back to "Sans Not-Rotated 12.9599609375px", expect ugly output.

How to run it? The error says that it is not supported under Windows Cairo <= 1.14.0, but on foreign forums they write that this module seems to work on Windows.
Tips to install ubuntu and python 3 can not be bothered, I'm aware, but the circumstances have developed and a specific solution is required.
If anyone has come across this problem, please help.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question