This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author hans.bering
Recipients brian.curtin, hans.bering, hfischer, r.david.murray, tim.golden
Date 2011-07-01.10:46:41
SpamBayes Score 2.8116023e-09
Marked as misclassified No
Message-id <1309517202.76.0.304486525861.issue10647@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2011-07-14 19:48:30terry.reedyunlinkissue10647 messages
2011-07-01 10:46:42hans.beringsetrecipients: + hans.bering, tim.golden, r.david.murray, brian.curtin, hfischer
2011-07-01 10:46:42hans.beringsetmessageid: <1309517202.76.0.304486525861.issue10647@psf.upfronthosting.co.za>
2011-07-01 10:46:42hans.beringlinkissue10647 messages
2011-07-01 10:46:41hans.beringcreate