New submission from Hans Bering <hans.ber...@arcor.de>:

The attached script will crash on a current Ubuntu with Python 3.2 + tcl/tk 
when using a locale which uses a comma as a decimal separator (e.g., German). 
It will not crash when using a locale which uses a dot as the decimal separator 
(e.g., English). In case of the crash, the output and stacktrace are as follows:

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"

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).

The locale dependency can make this problem difficult to debug when it occurs. 
In our setup, we had a program work on one machine, but it crashed on the next 
machine, which we believed to have an identical setup; it took us a day to 
figure out what the difference was. We would expect the constructor to either 
always work with float arguments, or to always reject them, regardless of 
locale.

We have been able to reproduce this issue both with Python 2.7.2 and Python 
3.2, both under a current Ubuntu and Windows 7.

----------
components: Tkinter
files: badScreenSizeTk.py
messages: 140338
nosy: hans.bering
priority: normal
severity: normal
status: open
title: Locale-dependent crash for float width argument to Tkinter widget 
constructor
type: crash
versions: Python 2.7, Python 3.2
Added file: http://bugs.python.org/file22653/badScreenSizeTk.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12558>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to