[Python-modules-team] Bug#809479: python3-cairo: Surface.get_data not implemented.
Benjamin Shi
aiifabbf at outlook.com
Thu Dec 31 03:05:00 UTC 2015
Package: python3-cairo
Version: 1.10.0+dfsg-4+b1
Severity: normal
Dear Maintainer,
I was trying to create a new ImageSurface object and get its pixel data, but it popped up the following error:
root at debian:/home/benjamin# python3
Python 3.4.2 (default, Oct 8 2014, 10:45:20)
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cairo
>>> surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 1600, 900)
>>> surface.get_data()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NotImplementedError: Surface.get_data: Not Implemented yet.
>>>
Then I built it from source downloaded at www.cairographics.org/pycairo, but Python3 reported cairo._cairo not found:
root at debian:/home/benjamin/桌面/pycairo# python3
Python 3.4.2 (default, Oct 8 2014, 10:45:20)
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cairo
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/cairo/__init__.py", line 18, in <module>
from ._cairo import *
ImportError: No module named 'cairo._cairo'
>>>
I found __init__.py and _cairo.cpython-34m.so were put in two different directories when 'python3 setup.py install':
creating /usr/local/lib/python3.4/dist-packages/cairo
copying build/lib.linux-x86_64-3.4/cairo/_cairo.cpython-34m.so -> /usr/local/lib/python3.4/dist-packages/cairo
running install_data
copying py3cairo.pc -> /usr/local/lib/pkgconfig
creating /usr/lib/python3/dist-packages/cairo
copying src/__init__.py -> /usr/lib/python3/dist-packages/cairo
running install_egg_info
Writing /usr/local/lib/python3.4/dist-packages/pycairo-1.10.1.egg-info
....so I put _cairo.cpython-34m.so into the same directory where __init__.py is located, which is /usr/lib/python3/dist-packages/cairo, and it worked as expected:
root at debian:/home/benjamin/桌面/pycairo# mv '/usr/local/lib/python3.4/dist-packages/cairo/_cairo.cpython-34m.so' '/usr/lib/python3/dist-packages/cairo'
root at debian:/home/benjamin/桌面/pycairo# python3
Python 3.4.2 (default, Oct 8 2014, 10:45:20)
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cairo
>>> surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 1600, 900)
>>> surface.get_data()
<memory at 0x7f85a38c5c00>
>>>
It seems, from www.cairographics.org/pycairo, that pycairo has not been updated for 4+ years, and source code actually contains this function:
static PyObject *
image_surface_get_data (PycairoImageSurface *o) {
return PyMemoryView_FromObject((PyObject*)o);
}
(clip from pycairo/src/surface.c line 579)
I wonder why Debian 8.2 still didn't make python3-cairo package from the latest source.
Thanks.
-- System Information:
Debian Release: 8.2
APT prefers stable
APT policy: (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=zh_CN.utf8, LC_CTYPE=zh_CN.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages python3-cairo depends on:
ii libc6 2.19-18+deb8u1
ii libcairo2 1.14.0-2.1
ii python3 3.4.2-2
python3-cairo recommends no packages.
python3-cairo suggests no packages.
-- no debconf information
More information about the Python-modules-team
mailing list