[issue10647] scrollbar crash in non-US locale format settings
Hans Bering
report at bugs.python.org
Fri Jul 1 12:46:42 CEST 2011
Hans Bering <hans.bering at arcor.de> added the comment:
I have been able to reproduce this problem with a current Python 3.2 + tcl/tk on Ubuntu. I have attached a script which should crash with the following output & stacktrace (you might have to find & set a suitable locale depending on your OS):
locale = ('de_DE', 'UTF8')
Traceback (most recent call last):
File "tkinterCrash.py", line 20, in <module>
tkcanvas = Canvas(master=master, width=w, height=2, borderwidth=4)
File "/usr/lib/python3.2/tkinter/__init__.py", line 2101, in __init__
Widget.__init__(self, master, 'canvas', cnf, kw)
File "/usr/lib/python3.2/tkinter/__init__.py", line 1961, in __init__
(widgetName, self._w) + extra + self._options(cnf))
_tkinter.TclError: bad screen distance "10.0"
The problem seems to stem from the fact that tkinter passes the "width" option through regardless of what it is (you can set w to the string "hello" to get the same error), and somewhere below (in tk, I guess?), the option argument is tentatively parsed as a number using the system's numeric locale.
Originally, we stumbled over this problem when using matplotlib, which passes/passed down float types as width arguments on occasions. It has been fixed there since (see https://github.com/matplotlib/matplotlib/pull/387).
It's the locale dependency which can make this difficult to debug when it occurs. In our setup, we had a program running on one machine, and then it crashed on the next, which we believed to have an identical setup; it took us a day to figure out what the difference was.
----------
nosy: +hans.bering
Added file: http://bugs.python.org/file22535/tkinterCrash.py
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10647>
_______________________________________
More information about the Python-bugs-list
mailing list