Matplotlib in a Zope and postgreSQL context


I realize this should be really two posts, but any how here it is :

1) Is there a way people know of integrating Matplotlib into Zope ? I had to
fight with the registry (yes, a windows box for now) to get matplotlib to
install on the right Python (Zope's, not the system Python) but more importantly
I am using an external method to gain access to matplotlib via Zope. It works,
but it's clumsy and I suspect loading up pylab could be quicker if I could use
Scripts (Python) objects in Zope.

As a side question, is there a way not to open a file, e.g. replace the
following lines :

fh = open("C:\\Program Files\\Plone 2\\Data\\bin\\test.png","rb")
data =

I had origianlly forgotten to close my file handle connection and it obviously
was a good way to kill my Zope app (laek was about 3 MB a shot!) so avoiding to
write in a file together with a closer integration into Zope would probably make
such memory leaks less susceptible to occur.

2) Is there an example somewhere along the lines of or but with data coming from a postgreSQL 8.0.2 back end ? One
question I have is about the use of DateTime objects with PG queries : can
PL/Python scripts handle DateTime objects directly or do I have to fiddle with
a combination of num2date and strftime (??) to build a meaningful SQL query?
Any pointers to example usage appreciated.

Thanx for this great plotting products. I'm looking forward to using more and
more of matplotlib's power!

Yves Moisan