classification
Title: Bug in scrolledtext
Type: behavior Stage: test needed
Components: Tkinter Versions: Python 3.1, Python 3.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: daniel.urban, georg.brandl, gpolo, quentel, r.david.murray, terry.reedy
Priority: normal Keywords: easy

Created on 2010-12-24 10:03 by quentel, last changed 2010-12-28 10:57 by georg.brandl. This issue is now closed.

Files
File name Uploaded Description Edit
unnamed quentel, 2010-12-25 08:35
Messages (7)
msg124593 - (view) Author: Pierre Quentel (quentel) * Date: 2010-12-24 10:03
The scrolledtext example crashes with this message :

TypeError: unsupported operand type(s) for +: 'dict_keys' and 'dict_keys'

It works if keys() are converted to lists in line 33 :

methods = list(vars(Pack).keys()) + list(vars(Grid).keys()) + \list(vars(Place).keys())

Configuration : Python 3.2b2 (r32b2:87398, Dec 19 2010, 22:51:00) [MSC v.1500 32 bit (Intel)] on win32
msg124594 - (view) Author: Daniel Urban (daniel.urban) * (Python triager) Date: 2010-12-24 10:54
It probably also works if | is used instead of +, because in 3.2 dict_proxy.keys() are a dict_keys, not a list. See issue10630 .
msg124604 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-12-24 20:02
Where is this example?
msg124605 - (view) Author: Daniel Urban (daniel.urban) * (Python triager) Date: 2010-12-24 20:15
I don't think, that this is in an example (but probably there is an example somewhere, that crashes because of this). I found the code in Lib/tkinter/scrolledtext.py
msg124618 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-12-24 22:39
Since 'methods' is converted to a set in the next line, there is no need for lists. Instead, use | and delete the conversion.
  methods = vars(Pack).keys() + vars(Grid).keys() + vars(Place).keys()
  methods = set(methods).difference(text_meths)
becomes
  methods = vars(Pack).keys() | vars(Grid).keys() | vars(Place).keys()
  methods = methods.difference(text_meths)

Now I am a little puzzled why this does not fail (3.2b1, winxp):
>>> from tkinter.scrolledtext import ScrolledText
>>> s = ScrolledText()
>>> s
<tkinter.scrolledtext.ScrolledText object at 0x00F6CF70>

On the other hand, this fails elsewhere:
>>> from tkinter.scrolledtext import example
>>> example()
Traceback (most recent call last):
  File "<pyshell#34>", line 1, in <module>
    example()
  File "C:\Programs\Python32\lib\tkinter\scrolledtext.py", line 49, in example
    stext.insert(END, __main__.__doc__)
  File "C:\Programs\Python32\lib\tkinter\__init__.py", line 2970, in insert
    self.tk.call((self._w, 'insert', index, chars) + args)
_tkinter.TclError: wrong # args: should be ".16421456.16190896 insert index chars ?tagList chars tagList ...?"
msg124632 - (view) Author: Pierre Quentel (quentel) * Date: 2010-12-25 08:35
The function example(), line 44 of the module
- Pierre

2010/12/24 R. David Murray <report@bugs.python.org>

>
> R. David Murray <rdmurray@bitdance.com> added the comment:
>
> Where is this example?
>
> ----------
> assignee:  -> docs@python
> components: +Documentation
> nosy: +docs@python, r.david.murray
> type: crash -> behavior
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue10768>
> _______________________________________
>
msg124782 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2010-12-28 10:57
Fixed in r87527.  Terry, the reason why calling example() interactively failed is the strange way __doc__ is imported -- it is None in your case and that causes the Tkinter type error.  I fixed this as well.
History
Date User Action Args
2010-12-28 10:57:09georg.brandlsetstatus: open -> closed

nosy: + georg.brandl
messages: + msg124782

resolution: fixed
2010-12-25 08:35:31quentelsetfiles: + unnamed

messages: + msg124632
nosy: terry.reedy, gpolo, r.david.murray, daniel.urban, quentel
2010-12-24 22:39:25terry.reedysetnosy: + gpolo, terry.reedy

messages: + msg124618
versions: + Python 3.1
2010-12-24 20:44:56r.david.murraysetnosy: - docs@python
assignee: docs@python ->
components: - Documentation
keywords: + easy
stage: test needed
2010-12-24 20:15:34daniel.urbansetnosy: r.david.murray, daniel.urban, docs@python, quentel
messages: + msg124605
2010-12-24 20:02:01r.david.murraysetnosy: + docs@python, r.david.murray
messages: + msg124604

assignee: docs@python
components: + Documentation
type: crash -> behavior
2010-12-24 10:54:44daniel.urbansetnosy: + daniel.urban
messages: + msg124594
2010-12-24 10:03:09quentelcreate