I'm a bit confused as to where the exception is actually
> getting raised. I suppose the renderer's write_png method
> must be in C?
> I implemented a tempfile solution, but I'm surprised that
> the cStringIO doesn't already work.
> Should it?
It should and I've looked at it but couldn't figure it out. The relevant method is
RendererAgg::write_png in src/_backend_agg.cpp. Someone should pull
up some PIL code (which I think supports this) and figure out how it
is done. The png method I am using uses a FILE* pointer -- I've
posted on python list how to get a FILE* from cStringIO but got no
help. There may be a more-better-different libpng method that can
work with some other interface.