matplotlib and Zope

David Dougall writes:

I am a new Zope user and am trying to use matplotlib in a Zope application and
need some guidance on how to do so.

From a previous post in February 2005 (2-17-05), someone had a similar

problem. > From the archives, I'm not quite sure it was solved.

This is the only related answer I found.

From: Yves Moisan <ymoisan@...780...>

I'm sorry I took so long to chime in, but I have to use gmane's web interface
and for some reason I couldn't get to see your message. I still can't, but at
least I can see one of Sascha's replies that I can do a follow up on.

My first go at integrating matplotlib into Zope was via an external method and I
sent you some code about that. However, integrating matplotlib functionnalities
through an External Method is a pain to maintain : any change to your function
means delete/recreate an External Method object in Zope. Not very sustainable.

A better way is to use Archetypes (is you are a Plone or at least a CMF user).
See thread at :

Saving a PNG to a file and then updating an Archetypes ImageField (as described
in the above link) works well. I've worked out a way to use a tempFile and I
guess it probably works without tempFile also. So long as you save it to an
Archetypes field.

If you try to pump the resulting image out e.g. in a tal statement, that is
without using an intermediate save step into an Archetypes field, then it won't
work (see thread above). If you happen to find a way of doing this, please let
me know. Using matplotlib in CMF/Plone for me currently implies having to add
an ImageField just to hold what usually amounts to be a temporary image. There
shouldn't be a need to store it in a content object.

Keep us posted on your trials!

Yves Moisan