From Christophe.Delarue at reuters.com Tue Feb 1 14:01:47 2005 From: Christophe.Delarue at reuters.com (Christophe Delarue) Date: Tue, 01 Feb 2005 14:01:47 +0100 Subject: [python-sybase] Patch on Sybase.py Message-ID: <2B674CE447106D46A53D0FDDC7DF8B1C095BF5@PTXSMSXM01.emea.ime.reuters.com> This is a multi-part message in MIME format. ------_=_NextPart_001_01C5085E.2F758243 Content-Type: multipart/alternative; boundary="----_=_NextPart_002_01C5085E.2F758243" ------_=_NextPart_002_01C5085E.2F758243 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I add to patch Sybase.py with attached patch file .. it just contains the add of DateTime =3D datetime if datetime is used instead of mx.DateTime --------------------------------------------------------------- - Visit our Internet site at http://www.reuters.com Get closer to the financial markets with Reuters Messaging - for more information and to register, visit http://www.reuters.com/messaging Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of Reuters Ltd. ------_=_NextPart_002_01C5085E.2F758243 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
I add to = patch=20 Sybase.py with attached patch file .. it just contains the add of DateTime = =3D=20 datetime if datetime is used instead of=20 mx.DateTime


--------------------------------------------------------------- -
Visit our Internet site at http://www.reuters.com

Get closer to the financial markets with Reuters Messaging - for more
information and to register, visit http://www.reuters.com/messaging

Any views expressed in this message are those of the individual
sender, except where the sender specifically states them to be
the views of Reuters Ltd.
------_=_NextPart_002_01C5085E.2F758243-- ------_=_NextPart_001_01C5085E.2F758243 Content-Type: text/plain; name="patch.txt" Content-Transfer-Encoding: base64 Content-Description: patch.txt Content-Disposition: attachment; filename="patch.txt" KioqIFN5YmFzZS5weQlUdWUgRmViICAxIDEzOjUyOjAwIDIwMDUKLS0tIFN5YmFzZS5weX4JTW9u IERlYyAxMyAxODoyMTo1OCAyMDA0CioqKioqKioqKioqKioqKgoqKiogNSwxMSAqKioqCiAgIwog IHRyeToKICAgICAgaW1wb3J0IGRhdGV0aW1lCi0gICAgIERhdGVUaW1lID0gZGF0ZXRpbWUKICAg ICAgdXNlX2RhdGV0aW1lID0gMQogIGV4Y2VwdCBJbXBvcnRFcnJvcjoKICAgICAgdHJ5OgotLS0g NSwxMCAtLS0tCg== ------_=_NextPart_001_01C5085E.2F758243-- From andrewjt at applecomm.net Fri Feb 11 02:31:17 2005 From: andrewjt at applecomm.net (Andrew Thomson) Date: Fri, 11 Feb 2005 12:31:17 +1100 Subject: [python-sybase] python sybase installation Message-ID: <1108085477.72921.7.camel@itouch-1011.prv.au.itouchnet.net> Hi, I'm now trying to use the sybase module under Linux RHEL 3 and Sybase 12.5. The module compiles and installs cleanly however scripts don't like importing Sybase. /temp.linux-i686-2.4/datetime.o build/temp.linux-i686-2.4/sybasect.o -L/opt/sybase/OCS-12_5/lib -o build/lib.linux-i686-2.4/sybasect.so running install_lib copying build/lib.linux-i686-2.4/Sybase.py -> /usr/local/lib/python2.4/site-packages copying build/lib.linux-i686-2.4/sybasect.so -> /usr/local/lib/python2.4/site-packages byte-compiling /usr/local/lib/python2.4/site-packages/Sybase.py to Sybase.pyc [root@scratch sybase-0.36]# [root@scratch sybase-0.36]# /usr/local/bin/python -ic "import Sybase" Traceback (most recent call last): File "", line 1, in ? File "Sybase.py", line 20, in ? from sybasect import * ImportError: /usr/local/lib/python2.4/site-packages/sybasect.so: undefined symbol: cs_dt_info I have tried this with Python 2.2 as per installed by RHEL 3 and also with Python 2.4. Any guidance appreciated. Regards, Andrew. -- Andrew Thomson From andrewm at object-craft.com.au Fri Feb 11 04:08:30 2005 From: andrewm at object-craft.com.au (Andrew McNamara) Date: Fri, 11 Feb 2005 14:08:30 +1100 Subject: [python-sybase] python sybase installation In-Reply-To: <1108085477.72921.7.camel@itouch-1011.prv.au.itouchnet.net> References: <1108085477.72921.7.camel@itouch-1011.prv.au.itouchnet.net> Message-ID: <20050211030830.3DB363C889@coffee.object-craft.com.au> >/temp.linux-i686-2.4/datetime.o build/temp.linux-i686-2.4/sybasect.o >-L/opt/sybase/OCS-12_5/lib -o build/lib.linux-i686-2.4/sybasect.so >running install_lib >copying build/lib.linux-i686-2.4/Sybase.py >-> /usr/local/lib/python2.4/site-packages >copying build/lib.linux-i686-2.4/sybasect.so >-> /usr/local/lib/python2.4/site-packages >byte-compiling /usr/local/lib/python2.4/site-packages/Sybase.py to >Sybase.pyc >[root@scratch sybase-0.36]# > >[root@scratch sybase-0.36]# /usr/local/bin/python -ic "import Sybase" >Traceback (most recent call last): > File "", line 1, in ? > File "Sybase.py", line 20, in ? > from sybasect import * >ImportError: /usr/local/lib/python2.4/site-packages/sybasect.so: >undefined symbol: cs_dt_info Try starting python like this and see if it makes any difference: $ LD_LIBRARY_PATH=/opt/sybase/OCS-12_5/lib python -ic "import Sybase" -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/ From andrewjt at applecomm.net Mon Feb 14 04:02:35 2005 From: andrewjt at applecomm.net (Andrew Thomson) Date: Mon, 14 Feb 2005 14:02:35 +1100 Subject: [python-sybase] python sybase installation In-Reply-To: <20050211030830.3DB363C889@coffee.object-craft.com.au> References: <1108085477.72921.7.camel@itouch-1011.prv.au.itouchnet.net> <20050211030830.3DB363C889@coffee.object-craft.com.au> Message-ID: <1108350155.72921.23.camel@itouch-1011.prv.au.itouchnet.net> On Fri, 2005-02-11 at 14:08 +1100, Andrew McNamara wrote: > >/temp.linux-i686-2.4/datetime.o build/temp.linux-i686-2.4/sybasect.o > >-L/opt/sybase/OCS-12_5/lib -o build/lib.linux-i686-2.4/sybasect.so > >running install_lib > >copying build/lib.linux-i686-2.4/Sybase.py > >-> /usr/local/lib/python2.4/site-packages > >copying build/lib.linux-i686-2.4/sybasect.so > >-> /usr/local/lib/python2.4/site-packages > >byte-compiling /usr/local/lib/python2.4/site-packages/Sybase.py to > >Sybase.pyc > >[root@scratch sybase-0.36]# > > > >[root@scratch sybase-0.36]# /usr/local/bin/python -ic "import Sybase" > >Traceback (most recent call last): > > File "", line 1, in ? > > File "Sybase.py", line 20, in ? > > from sybasect import * > >ImportError: /usr/local/lib/python2.4/site-packages/sybasect.so: > >undefined symbol: cs_dt_info > > Try starting python like this and see if it makes any difference: > > $ LD_LIBRARY_PATH=/opt/sybase/OCS-12_5/lib python -ic "import Sybase" > > Thanks for the suggestion Andrew. I believe my Sybase environment was already setup ok with the following variables set. [ajt@scratch ajt]$ env | grep -i ld LD_LIBRARY_PATH=/opt/sybase/OCS-12_5/lib:/opt/sybase/OCS-12_5/lib3p:/opt/sybase/SQLRemote/lib:/opt/sybase/ASE-12_5/lib:/opt/tibco/tibrv/lib Nonetheless, I tried your suggestion as follows: [ajt@scratch ajt]$ LD_LIBRARY_PATH=/opt/sybase/OCS-12_5/lib python -ic "import Sybase" Traceback (most recent call last): File "", line 1, in ? File "/usr/local/lib/python2.4/site-packages/Sybase.py", line 20, in ? from sybasect import * ImportError: /usr/local/lib/python2.4/site-packages/sybasect.so: undefined symbol: cs_dt_info >>> Any further pointers appreciated. Thanks, ajt. -- Andrew Thomson From andrewm at object-craft.com.au Mon Feb 14 05:42:36 2005 From: andrewm at object-craft.com.au (Andrew McNamara) Date: Mon, 14 Feb 2005 15:42:36 +1100 Subject: [python-sybase] python sybase installation In-Reply-To: <1108350155.72921.23.camel@itouch-1011.prv.au.itouchnet.net> References: <1108085477.72921.7.camel@itouch-1011.prv.au.itouchnet.net> <20050211030830.3DB363C889@coffee.object-craft.com.au> <1108350155.72921.23.camel@itouch-1011.prv.au.itouchnet.net> Message-ID: <20050214044236.1C51D3C889@coffee.object-craft.com.au> >Nonetheless, I tried your suggestion as follows: [...] >ImportError: /usr/local/lib/python2.4/site-packages/sybasect.so: >undefined symbol: cs_dt_info What does the output of: $ ldd /usr/local/lib/python2.4/site-packages/sybasect.so look like? I know very little about Sybase (I don't have it installed, either), but I've been working with the dynamic linkers under Linux (and Solaris) for years. I've seen this specific problem mentioned on the list a few times, but I can't find a solution in the list archives. The error is more suggestive of an incorrect library version, rather than a missing file, so pay careful attention to the paths. You can also use ldd to explore the shared dependancies of any other libraries being used by sybasect.so. -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/ From jfabiani at yolo.com Sat Feb 12 02:20:55 2005 From: jfabiani at yolo.com (John Fabiani) Date: Fri, 11 Feb 2005 17:20:55 -0800 Subject: [python-sybase] where is the driver Message-ID: Hi, I'd like to get python taking (connecting) to sybase from SUSE 9.2. Is there a set of instructions somewhere on the web? John From andrewjt at applecomm.net Mon Feb 14 06:28:04 2005 From: andrewjt at applecomm.net (Andrew Thomson) Date: Mon, 14 Feb 2005 16:28:04 +1100 Subject: [python-sybase] python sybase installation In-Reply-To: <20050214044236.1C51D3C889@coffee.object-craft.com.au> References: <1108085477.72921.7.camel@itouch-1011.prv.au.itouchnet.net> <20050211030830.3DB363C889@coffee.object-craft.com.au> <1108350155.72921.23.camel@itouch-1011.prv.au.itouchnet.net> <20050214044236.1C51D3C889@coffee.object-craft.com.au> Message-ID: <1108358885.72921.28.camel@itouch-1011.prv.au.itouchnet.net> On Mon, 2005-02-14 at 15:42 +1100, Andrew McNamara wrote: > What does the output of: > > $ ldd /usr/local/lib/python2.4/site-packages/sybasect.so > > look like? Andrew, Here's the output.. looks good? [ajt@scratch ajt]$ ldd /usr/local/lib/python2.4/site-packages/sybasect.so libpthread.so.0 => /lib/tls/libpthread.so.0 (0x004c9000) libc.so.6 => /lib/tls/libc.so.6 (0x00e6a000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x008af000) I also did it for my 2.2 installation.. [ajt@scratch ajt]$ ldd /usr/lib/python2.2/site-packages/sybasect.so libc.so.6 => /lib/tls/libc.so.6 (0x0070b000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00a14000) Looks exciting! ;) Regards, ajt. > > I know very little about Sybase (I don't have it installed, either), > but I've been working with the dynamic linkers under Linux (and Solaris) > for years. I've seen this specific problem mentioned on the list a few > times, but I can't find a solution in the list archives. The error is > more suggestive of an incorrect library version, rather than a missing > file, so pay careful attention to the paths. > > You can also use ldd to explore the shared dependancies of any other > libraries being used by sybasect.so. > -- Andrew Thomson From andrewm at object-craft.com.au Mon Feb 14 08:34:07 2005 From: andrewm at object-craft.com.au (Andrew McNamara) Date: Mon, 14 Feb 2005 18:34:07 +1100 Subject: [python-sybase] python sybase installation In-Reply-To: <1108358885.72921.28.camel@itouch-1011.prv.au.itouchnet.net> References: <1108085477.72921.7.camel@itouch-1011.prv.au.itouchnet.net> <20050211030830.3DB363C889@coffee.object-craft.com.au> <1108350155.72921.23.camel@itouch-1011.prv.au.itouchnet.net> <20050214044236.1C51D3C889@coffee.object-craft.com.au> <1108358885.72921.28.camel@itouch-1011.prv.au.itouchnet.net> Message-ID: <20050214073407.A81B73C889@coffee.object-craft.com.au> >Here's the output.. looks good? > >[ajt@scratch ajt]$ >ldd /usr/local/lib/python2.4/site-packages/sybasect.so > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x004c9000) > libc.so.6 => /lib/tls/libc.so.6 (0x00e6a000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x008af000) > >I also did it for my 2.2 installation.. > >[ajt@scratch ajt]$ ldd /usr/lib/python2.2/site-packages/sybasect.so > libc.so.6 => /lib/tls/libc.so.6 (0x0070b000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00a14000) > >Looks exciting! ;) Hmmm - either it statically linked with the sybase client lib, or it's pulling in shared libs by hand. Anyone on the list have a better idea what it's up to? You might want to try running strace (linux) or truss (solaris) on python as it starts. Something like: strace -o /tmp/trace.out -f python -ic "import Sybase" The contents of trace.out will be too large to post to the list, but reading through it might give some clues as to how it's pulling in the client libs. Jump to where it's reading sybasect.so and see what happens after that. -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/ From gnb at itga.com.au Mon Feb 14 09:12:26 2005 From: gnb at itga.com.au (Gregory Bond) Date: Mon, 14 Feb 2005 19:12:26 +1100 Subject: [python-sybase] python sybase installation In-Reply-To: <20050214073407.A81B73C889@coffee.object-craft.com.au> References: <1108085477.72921.7.camel@itouch-1011.prv.au.itouchnet.net> <20050211030830.3DB363C889@coffee.object-craft.com.au> <1108350155.72921.23.camel@itouch-1011.prv.au.itouchnet.net> <20050214044236.1C51D3C889@coffee.object-craft.com.au> <1108358885.72921.28.camel@itouch-1011.prv.au.itouchnet.net> <20050214073407.A81B73C889@coffee.object-craft.com.au> Message-ID: <42105D6A.4060200@itga.com.au> Andrew McNamara wrote: >Hmmm - either it statically linked with the sybase client lib, or it's >pulling in shared libs by hand. Anyone on the list have a better idea >what it's up to? > > > > The sybase libs do dlopen() (or equiv) to link some of their libraries at connect time, so ldd doesn't help much. You've pretty much gotta have the correct LD_LIBRARY_PATH at runtime. From andrewm at object-craft.com.au Mon Feb 14 10:38:10 2005 From: andrewm at object-craft.com.au (Andrew McNamara) Date: Mon, 14 Feb 2005 20:38:10 +1100 Subject: [python-sybase] python sybase installation In-Reply-To: <42105D6A.4060200@itga.com.au> References: <1108085477.72921.7.camel@itouch-1011.prv.au.itouchnet.net> <20050211030830.3DB363C889@coffee.object-craft.com.au> <1108350155.72921.23.camel@itouch-1011.prv.au.itouchnet.net> <20050214044236.1C51D3C889@coffee.object-craft.com.au> <1108358885.72921.28.camel@itouch-1011.prv.au.itouchnet.net> <20050214073407.A81B73C889@coffee.object-craft.com.au> <42105D6A.4060200@itga.com.au> Message-ID: <20050214093810.278963C889@coffee.object-craft.com.au> >>Hmmm - either it statically linked with the sybase client lib, or it's >>pulling in shared libs by hand. Anyone on the list have a better idea >>what it's up to? > >The sybase libs do dlopen() (or equiv) to link some of their libraries >at connect time, so ldd doesn't help much. You've pretty much gotta have >the correct LD_LIBRARY_PATH at runtime. Ta. That's what I suspected. Is it using LD_LIBRARY_PATH in that case, or some other environment variable (if they're using dlopen(), they can take their choice)? Anyway, strace should reveal if it's coming off the rails and pulling in an old version of the lib. -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/ From gnb at itga.com.au Mon Feb 14 23:09:07 2005 From: gnb at itga.com.au (Gregory Bond) Date: Tue, 15 Feb 2005 09:09:07 +1100 Subject: [python-sybase] python sybase installation In-Reply-To: <20050214093810.278963C889@coffee.object-craft.com.au> References: <1108085477.72921.7.camel@itouch-1011.prv.au.itouchnet.net> <20050211030830.3DB363C889@coffee.object-craft.com.au> <1108350155.72921.23.camel@itouch-1011.prv.au.itouchnet.net> <20050214044236.1C51D3C889@coffee.object-craft.com.au> <1108358885.72921.28.camel@itouch-1011.prv.au.itouchnet.net> <20050214073407.A81B73C889@coffee.object-craft.com.au> <42105D6A.4060200@itga.com.au> <20050214093810.278963C889@coffee.object-craft.com.au> Message-ID: <42112183.9060809@itga.com.au> Andrew McNamara wrote: >Ta. That's what I suspected. Is it using LD_LIBRARY_PATH in that case, or >some other environment variable > It uses LD_LIBRARY_PATH, because that's what the SYBASE.sh script sets. (I think the dlopen is for the transport stuff, so at connect time it dynamically links the appropriate transport library.) From sebok1 at enternet.hu Wed Feb 23 17:09:12 2005 From: sebok1 at enternet.hu (=?ISO-8859-2?Q?Seb=F5k_Norbert?=) Date: Wed, 23 Feb 2005 17:09:12 +0100 Subject: [python-sybase] GTK & Sybase Message-ID: <421CAAA8.7030807@enternet.hu> Hi! 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? Thanks, Norbert Sebok From andrewm at object-craft.com.au Wed Feb 23 23:05:41 2005 From: andrewm at object-craft.com.au (Andrew McNamara) Date: Thu, 24 Feb 2005 09:05:41 +1100 Subject: [python-sybase] GTK & Sybase In-Reply-To: <421CAAA8.7030807@enternet.hu> References: <421CAAA8.7030807@enternet.hu> Message-ID: <20050223220541.960A83C889@coffee.object-craft.com.au> >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/ From sebok1 at enternet.hu Thu Feb 24 17:50:56 2005 From: sebok1 at enternet.hu (=?ISO-8859-1?Q?Sebo=22k_Norbert?=) Date: Thu, 24 Feb 2005 17:50:56 +0100 Subject: [python-sybase] GTK & Sybase In-Reply-To: <17542.193.145.16.10.1109242052.squirrel@193.145.16.10> References: <421CAAA8.7030807@enternet.hu> <20050223220541.960A83C889@coffee.object-craft.com.au> <17542.193.145.16.10.1109242052.squirrel@193.145.16.10> Message-ID: <421E05F0.6050206@enternet.hu> This locale feature is started on 19-Jul-2003 in PEP 331, the latest Sybase module is created on 27-Apr-2003. I think it's not use this feature yet. Anyway, I wrote my own converter. It's ugly solution and maybe slow, but it's works... def sybase_num_to_python_float(sybase_num): if sybase_num == None: return None elif not '.' in str(sybase_num): return int(sybase_num) else: if '-' in str(sybase_num): negative = True whole,decimal = str(sybase_num).replace('-','').split('.') else: negative = False whole,decimal = str(sybase_num).split('.') value = float(whole) + float(decimal) / (10 ** len(decimal)) if negative: value = - value return value Norbert Sebok >Probably related to this: > >This is one of the new things in Python 2.4. Now there is a >locale-independent (C locale) way of treating numbers. I bet the module >has to be adapted to this change to take advantage of this fact (and >letting users choose their own locale without breaking apps). > >http://www.python.org/doc/2.4/whatsnew/node11.html > >Andrew McNamara dijo: > > >>>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) >> >> From andrewm at object-craft.com.au Thu Feb 24 23:27:56 2005 From: andrewm at object-craft.com.au (Andrew McNamara) Date: Fri, 25 Feb 2005 09:27:56 +1100 Subject: [python-sybase] GTK & Sybase In-Reply-To: <17542.193.145.16.10.1109242052.squirrel@193.145.16.10> References: <421CAAA8.7030807@enternet.hu> <20050223220541.960A83C889@coffee.object-craft.com.au> <17542.193.145.16.10.1109242052.squirrel@193.145.16.10> Message-ID: <20050224222756.E73D33C8E3@coffee.object-craft.com.au> >Probably related to this: > >This is one of the new things in Python 2.4. Now there is a >locale-independent (C locale) way of treating numbers. I bet the module >has to be adapted to this change to take advantage of this fact (and >letting users choose their own locale without breaking apps). > >http://www.python.org/doc/2.4/whatsnew/node11.html It's certainly related, but I don't think the 2.4 changes were the cause. What is almost certainly happening is that GTK is changing the locale, which effects the conversion within the python-sybase modules C code. If python-sybase used the new interface (when available), that would hopefully eliminate this problem. Someone who uses locales want to find the offending conversions and post a patch? -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/ From marcos at burke.ath.cx Thu Feb 24 11:47:32 2005 From: marcos at burke.ath.cx (Marcos =?iso-8859-1?Q?S=E1nchez_Provencio?=) Date: Thu, 24 Feb 2005 11:47:32 +0100 (CET) Subject: [python-sybase] GTK & Sybase In-Reply-To: <20050223220541.960A83C889@coffee.object-craft.com.au> References: <421CAAA8.7030807@enternet.hu> <20050223220541.960A83C889@coffee.object-craft.com.au> Message-ID: <17542.193.145.16.10.1109242052.squirrel@193.145.16.10> Probably related to this: This is one of the new things in Python 2.4. Now there is a locale-independent (C locale) way of treating numbers. I bet the module has to be adapted to this change to take advantage of this fact (and letting users choose their own locale without breaking apps). http://www.python.org/doc/2.4/whatsnew/node11.html Andrew McNamara dijo: >>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) >