psycopg2, gtk and float

S

Sandro Dentella

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]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top