Dnia 17-01-2005, pon o godzinie 20:42 -0500, Stéphane Brunet napisał:
> I have got a strange problem when converting a string into a float.
> When using Canadian French localisation (LANG=fr_CA), the locale.atof()
> function doesn't behave as usual.
>
> This code should run without problem :
>
> import locale
> locale.setlocale(locale.LC_ALL, '')
> locale.atof("3,1415")
>
> However, this one throws an exception (on Windows only) :
>
> import locale
> locale.setlocale(locale.LC_ALL, '')
> import pygtk
> pygtk.require('2.0')
> import gtk
> locale.atof("3,1415") <-- Thows a ValueError exception
>
> Note that de decimal separator is a comma in canadian french...
>
> I tried the code on linux with Python 2.3 and PyGTK 2.4.1 and everything
> works fine.
> On windows I have Python 2.4 and PyGTK 2.4.1. Unfortunately, my
> application must run on Windows...
>
> Does anyone had the same problem before ?
Just a guess, but what does your control panel say about decimal
separator in canadian french locale? Maybe that's the problem...
HTH,
Maciej
--
"Tautologizm to coś tautologicznego"
Maciej Katafiasz <[EMAIL PROTECTED]>
http://mathrick.org
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/