psycopg2, gtk and float

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sandro Dentella

    #1

    psycopg2, gtk and float

    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=local host 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@e-den.it
    http://www.tksql.org TkSQL Home page - My GPL work
Working...