OpenBSD, PyCha and the Memory Error.
From the PyCha website:
Pycha is a very simple Python package for drawing charts using the great Cairo library.
And it is the perfect replacement for pychart, an old library to render charts that I've been using in my projects since near 2003.
Of course pychart is still a fine option to create charts from your python scripts, but the result is quite better with PyCha (you only have to take a look over the examples on both projects' websites to know what I mean).
Well, that's True partially. Some weeks ago I've found an interesting problem with PyCha running on an OpenBSD server. I installed both pycairo and cairo from packages and PyCha from sources (as there was no package for my openbsd version, OpenBSD 4.4 already has a package).
I set up my python project (a django app in this case that asks users for some data and then creates some nice-looking charts from it) and I do some tests on it, just to check everything is running fine.
As soon as my app tried to generate a chart, I got an ugly Memory Error message:
At first I thought about some python memory limitation (as you can set some settings on compilation time), but it sounded somehow strange. I've been using python in OpenBSD machines for a long time now, and I've never found such problem.
A little more digging over the internet and I found a ticket in the project trac site, related to a MemoryError in FreeBSD, which pointed directly to cairo:
I installed cairo without x11, so I had no fonts installed. Installed freefont-ttf and now it works. I think cairo has no detection, if a font is missing, so it just crashes.
Nice error checking guys! There is no font, why we should show a "there is no fonts available", it is by far much better to crash the thing!.
As I've said, this is a server, so I've no X* install sets in it (more information about install sets here). That means no X11 fonts. Problem found!.
# cd / # tar xzvphf xfont42.tgz
A restart on the app server and it worked fine since then.