OpenBSD, PyCha and the Memory Error.
December 2014
Sun Mon Tue Wed Thu Fri Sat
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
About
This site is an effort to share some of the base knowledge I have gathered through all this years working with Linux, FreeBSD, OpenBSD, Python or Zope, among others. So, take a look around and I hope you will find the contents useful.
Recent Entries
Recent Comments
Recent Trackbacks
Categories
OpenBSD (8 items)
BSD (0 items)
FreeBSD (19 items)
Linux (3 items)
Security (3 items)
Python (18 items)
Zope (13 items)
Daily (139 items)
e-shell (9 items)
Hacks (13 items)
PostgreSQL (3 items)
OSX (7 items)
Nintendo DS (0 items)
enlightenment (0 items)
Apache (3 items)
Nintendo Wii (1 items)
Django (23 items)
Music (12 items)
Plone (7 items)
Varnish (0 items)
Lugo (2 items)
Sendmail (0 items)
europython (7 items)
Cherokee (1 items)
self (1 items)
Nature (1 items)
Hiking (0 items)
uwsgi (0 items)
nginx (0 items)
bikes (0 items)
Archives

Syndicate this site (XML)

RSS/RDF 0.91

23 enero
2009

OpenBSD, PyCha and the Memory Error.

you are missing the fonts!, tha's the key!

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).

PyCha depends on pycairo which depends on cairo, while pychart depends on ghostscript, and you can run both of them mostly without a problem in any unix-like operating system, like OpenBSD.

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:

Memory Error Pycha OpenBSD

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!.

The solution:

I follow the instructions from the OpenBSD FAQ on adding a file set after install, I just grabbed the xfont42.tgz from ftp.openbsd.org and unpacked it on the root of the server:

# cd /
# tar xzvphf xfont42.tgz

A restart on the app server and it worked fine since then.

Posted by wu at 13:50 | Comments (0) | Trackbacks (0)
<< django forms and where to add dynamic choices | Main | Monitoring apache VirtualHosts activity >>
Comments
There are no comments.
Trackbacks
Please send trackback to:http://blog.e-shell.org/131/tbping
There are no trackbacks.
Post a comment