<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Python fails when loading Cairo dll: OSError 0x7e"
href="https://bugs.freedesktop.org/show_bug.cgi?id=72094">72094</a>
</td>
</tr>
<tr>
<th>Assignee</th>
<td>cairo-bugs@cairographics.org
</td>
</tr>
<tr>
<th>Summary</th>
<td>Python fails when loading Cairo dll: OSError 0x7e
</td>
</tr>
<tr>
<th>QA Contact</th>
<td>cairo-bugs@cairographics.org
</td>
</tr>
<tr>
<th>Severity</th>
<td>major
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows (All)
</td>
</tr>
<tr>
<th>Reporter</th>
<td>erik.norvelle@neomailbox.net
</td>
</tr>
<tr>
<th>Hardware</th>
<td>x86-64 (AMD64)
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Component</th>
<td>win32 backend
</td>
</tr>
<tr>
<th>Product</th>
<td>cairo
</td>
</tr></table>
<p>
<div>
<pre>I run Python 3.3 (Anaconda distribution) under Windows 7, 64-bit. I have
attempted to install the Weasyprint app/library, which has a number of
dependencies, of which Cairo is one. I have put a lot of work into solving this
problem, which I summarize below. I have attempted to be totally complete with
this bug report, so I would appreciate your taking a close look.
The environment I have is as follows: Windows 7 SP1 64-bit, Python 3.3 64 bit
(CPython, as compiled and distributed by the www.python.org site), CFFI
compiled (by me) under Visual Studio 2010 with a 64-bit environment, and
Cairo's libcairo-2.dll also in the 64-bit version available from
cairographics.org. From what I can tell, my version of the Cairo dll (which is
the one I downloaded from the cairographics.org site) was compiled under Visual
Studio 2008, which appears to be causing the problem. [This is only my guess, I
am NOT an expert Windows programmer]
When I run weasyprint, it chokes during the import loading process,
specifically when it calls CFFI (a DLL loader for Python) in order to load the
GTK+-compatible library dll for Cairo. The error that I get is as follows:
$ weasyprint
Traceback (most recent call last):
File
"c:\anaconda\envs\py33\lib\site-packages\cffi-0.8-py3.3-win-amd64.egg\cffi\api.py",
line 399, in _make_ffi_library
backendlib = backend.load_library(name, flags)
OSError: cannot load library libcairo-2.dll: error 0x7e
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Anaconda\envs\py33\Scripts\weasyprint-script.py", line 9, in
<module>
load_entry_point('WeasyPrint==0.20', 'console_scripts', 'weasyprint')()
File "C:\Anaconda\envs\py33\lib\site-packages\pkg_resources.py", line 343, in
load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "C:\Anaconda\envs\py33\lib\site-packages\pkg_resources.py", line 2355,
in load_entry_point
return ep.load()
File "C:\Anaconda\envs\py33\lib\site-packages\pkg_resources.py", line 2061,
in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File
"c:\anaconda\envs\py33\lib\site-packages\weasyprint-0.20-py3.3.egg\weasyprint\__init__.py",
line 309, in <module>
from .css import PARSER, preprocess_stylesheet
File
"c:\anaconda\envs\py33\lib\site-packages\weasyprint-0.20-py3.3.egg\weasyprint\css\__init__.py",
line 30, in <module>
from . import computed_values
File
"c:\anaconda\envs\py33\lib\site-packages\weasyprint-0.20-py3.3.egg\weasyprint\css\computed_values.py",
line 18, in <module>
from .. import text
File
"c:\anaconda\envs\py33\lib\site-packages\weasyprint-0.20-py3.3.egg\weasyprint\text.py",
line 18, in <module>
import cairocffi as cairo
File
"c:\anaconda\envs\py33\lib\site-packages\cairocffi-0.5.1-py3.3.egg\cairocffi\__init__.py",
line 39, in <module>
cairo = dlopen(ffi, 'libcairo-2.dll', 'cairo', 'libcairo-2')
File
"c:\anaconda\envs\py33\lib\site-packages\cairocffi-0.5.1-py3.3.egg\cairocffi\__init__.py",
line 34, in dlopen
return ffi.dlopen(names[0]) # pragma: no cover
File
"c:\anaconda\envs\py33\lib\site-packages\cffi-0.8-py3.3-win-amd64.egg\cffi\api.py",
line 117, in dlopen
lib, function_cache = _make_ffi_library(self, name, flags)
File
"c:\anaconda\envs\py33\lib\site-packages\cffi-0.8-py3.3-win-amd64.egg\cffi\api.py",
line 405, in _make_ffi_library
backendlib = backend.load_library(path, flags)
OSError: cannot load library C:\Windows\system32\libcairo-2.dll: error 0x7e
I have tried to rebuild the Cairo library using the "end to end" instructions,
but the instructions are for use under Visual Studio 2008, and I have Visual
Studio Express 2010 (with Windows SDK 7.1 installed), which does not have
vcbuild.exe, and as a result I cannot follow the instructions given at
<a href="http://cairographics.org/end_to_end_build_for_win32/">http://cairographics.org/end_to_end_build_for_win32/</a>). Furthermore, because my
Python was built with VS 2010, I believe I am obligated to use a Cairo DLL
compiled with the same version. Correct me if I am wrong.
I am not a Windows programmer, and am only delving into this mess because I
want to get Weasyprint to work for another (Python language) project. I have
done a minor bit of Windows programming a long time ago under Delphi, so I have
a vague grasp of how this stuff works, but I have been unable to solve this
problem.
I would be happy to put the work into compiling Cairo for my
platform/configuration, and would make the resulting file(s) available for
redistribution, but I will need at least some assistance in doing so.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the QA Contact for the bug.</li>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>