wxPython & floating point numbers ?

Vadim Zeitlin zeitlin at seth.lpthe.jussieu.fr
Sat Dec 9 19:41:19 EST 2000


On 09 Dec 2000 18:22:06 +0100, Ueli Schlaepfer <u_schlaepfer at bluewin.ch> wrote:
>Hi everyone,
>
>when using the otherwise excellent wxPython package, I observe the
>following strange behaviour:
>
>>>> print 0.1
>0.1
>>>> import wxPython.wx
>>>> print 0.1
>0.0
...
>Has anybody seen the same error?

 No, but I've seen a similar one which was due to the fact that GDK (used by
GTK+ used by wxGTK used by wxPython) changes the current locale by itself.
And if in the new locale the decimal separator symbol is not period any more
this might cause problems (although I still fail to see how can this lead to
the result above to be honest).

 To check if this guess is correct, just unset LANG and all LC_XXX environment
variables and repeat the test above.

>What is the solution, if there is any?

 If the problem is due to this, just do "LANG=C python" instead of just
"python" (assuming you use a ksh-derived shell).

 Regards,
VZ

-- 
GCS/GM d? H+ s++:-- p2 au--- a- w+ v C+++ UBLS+++ P- L++ N++ E--- W++++ M? V--
-po+ R++ G`` !tv b+++ D--- e++++ u++ h--- f+ r++ n- y?



More information about the Python-list mailing list