Thank you very much for your answer!
I post the full solution to anyone else maybe need it:
try:
        conn = psycopg2.connect("dbname='...' user='...' host='127.0.0.1'
password='....'");
except:
        print "I am unable to connect to the database"
curs = conn.cursor()
........ code to create image/graph....... #canvas contains graph
import StringIO
data=StringIO.StringIO()
canvas.print_figure(data, dpi=150, format="png")
sql = "update table set image=%s;"
curs.execute(sql,(encoded_data,))
conn.commit()



2009/12/19 Jae-Joon Lee <lee.j.j...@gmail.com>

> On Fri, Dec 18, 2009 at 3:06 AM, Panagiotis Kontaxis <pkont...@gmail.com>
> wrote:
> > I found only the figure.savefig() function that saves figure's image only
> as
> > a filename in the filesystem and not in a local variable.
>
>
>
> http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.savefig
>
> savefig can take any file-like object, not just a file name.
>
> Check your matplotlib version, and upgrade if you can.
>
> Regards,
>
> -JJ
>
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to