On Dec 13, 2009, at 3:10 PM, Nop wrote:

>
> Hi!
>
> Am 13.12.2009 23:25, schrieb Dane Springmeyer:
>> install cairo's python bindings like:
>>
>> sudo apt-get install python-cairo
>>
>> and I think the problem will be fixed.
>
> Before I ask my admin, two questions:
>
> - Does this explain why it crashes on render(), but it does work  
> with render_to_file() ?
>

Yes, render_to_file() does not have a function that uses cairo  
directly like render() does.

> - Would this be fixed in 0.7?
>

Yes, I made a change in trunk 5 months ago to ensure this will not  
crash when the dependency is missing.

http://trac.mapnik.org/changeset/1278/trunk/bindings/python/python_cairo.cpp

But, this problem is something that is only likely to happen with pre- 
built packages because to prompt the crash you must have compiled  
mapnik against the python-cairo headers and then removed the module.

Just to illustrate this subtle bug, here is a fresh karmic machine  
(server edition which does not have python-cairo installed by default,  
unlike desktop versions which do):

r...@localhost:~# python
Python 2.6.4rc2 (r264rc2:75497, Oct 20 2009, 02:54:09)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import mapnik
 >>> m = mapnik.Map(1,1)
 >>> im = mapnik.Image(1,1)
 >>> mapnik.render_to_file(m,'test.png')
 >>> mapnik.render(m,im)
Segmentation fault

r...@localhost:~# sudo apt-get install python-cairo
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
   python-cairo
0 upgraded, 1 newly installed, 0 to remove and 10 not upgraded.
Need to get 0B/105kB of archives.
After this operation, 410kB of additional disk space will be used.
Selecting previously deselected package python-cairo.
(Reading database ... 15015 files and directories currently installed.)
Unpacking python-cairo (from .../python- 
cairo_1.8.6-1ubuntu1_amd64.deb) ...
Setting up python-cairo (1.8.6-1ubuntu1) ...

Processing triggers for python-support ...
r...@localhost:~# python
Python 2.6.4rc2 (r264rc2:75497, Oct 20 2009, 02:54:09)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import mapnik
 >>> m = mapnik.Map(1,1)
 >>> im = mapnik.Image(1,1)
 >>> mapnik.render_to_file(m,'test.png')
 >>> mapnik.render(m,im)
 >>> exit()
_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to