[pygtk] gnome.init ReallyFatalBug

Jakub Piotr Cłapa loc at toya.net.pl
Sun Mar 21 04:23:11 WST 2004


ipython session:

===========================================================================
[jpc at loc magazyn]$ ipython
Python 2.3.3 (#1, Mar 14 2004, 18:28:33)
Type "copyright", "credits" or "license" for more information.

IPython 0.5.0 -- An enhanced Interactive Python.
?       -> Introduction to IPython's features.
@magic  -> Information about IPython's 'magic' @ functions.
help    -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.

In [1]: f = float("0.123123")

In [2]: f
Out[2]: 0.123123

In [3]: import gnome

In [4]: f
Out[4]: 0.123123

In [5]: gnome.init("shit", "more shit")
Out[5]: <gnome.Program object (GnomeProgram) at 0x406c2694>

In [6]: f
Out[6]: 0,123123

In [7]: f = float("0.123123")
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)

/home/users/jpc/magazyn/<console>

ValueError: invalid literal for float(): 0.123123

In [8]:
===========================================================================

locale setting:

===========================================================================
[jpc at loc magazyn]$ locale
LANG=pl_PL
===========================================================================

When I set LC_ALL to "C" everything works fine. It seems that gnome.init 
somehow modifies standard python way of handling literals according to 
the locale. That's a really Bad Thing(TM).

I would never found the reason, if it didn't cause pysqlite to return 
None, when I forced 'float' as a field type (with "-- types float" 
query). When nothing was forced it returned floats, but rounded to 
integers! The Worst Thing I Could Imagine(TM).

-- 
regards,
Jakub Piotr Cłapa


More information about the pygtk mailing list