psycopg2, gtk and float

Sandro Dentella sandro at e-den.it
Wed Jun 14 17:50:24 EDT 2006


Hi all,

while building an applycation in pygtk I noticed that psycopg2 returns the
floats rouded (eg: 4.123 -> 4.0).

This turns out to be a problem of psycopg2 (psycopg behaves correctly) when
you 'import gtk' !!! It behaves correctly with numeric/decimal, though.

I'm totally clueless. Any hints?

TIA
sandro
*:-)




import gtk
import psycopg2 as ps2

DB = "host=localhost dbname=test user=test port=5432 password=xxx"
conn = ps2.connect(DB)
cursor = conn.cursor()
cursor.executeq("SELECT DISTINCT a_float FROM numbers ")
conn.commit()

rows = cursor.fetchall()
for row in rows:
    print row[0]


-- 
Sandro Dentella  *:-)
e-mail: sandro at e-den.it 
http://www.tksql.org                    TkSQL Home page - My GPL work



More information about the Python-list mailing list