[python-sybase] GTK & Sybase

Andrew McNamara andrewm at object-craft.com.au
Thu, 24 Feb 2005 09:05:41 +1100


>I have some problem, when I use Sybase module with GTK:
>
>  cursor.execute(" select 1.2 ")
>  num = cursor.fetchone()[0]
>  print num           # 1.2
>  print float(1.2)    # 1.2
>  print float(num)    # 1.2
>
>  import gtk
>  print num           # 1.2
>  print float(1.2)    # 1.2
>  print float(num)    # 1.0  <- not 1.2
>
>
>After import gtk, the float truncates the decimal.
>How can I fix this?

This is a shot in the dark, but could gtk be setting the locale?

It might also be useful to print the type of num, eg:

    print type(num)

-- 
Andrew McNamara, Senior Developer, Object Craft
http://www.object-craft.com.au/