[issue6512] UnicodeDecodeError: 'utf8' codec can't decode bytes in position 0-1: illegal encoding

Winfried Plappert report at bugs.python.org
Sat Jul 18 10:00:20 CEST 2009


New submission from Winfried Plappert <Winfried.Plappert at gmx.de>:

When running the attached program, it will fail with above message on
Control-2 only! All other control keys work happily.

The same program under MS-Windows seems to work (I am under Linux, so I
can't switch easily). 

My version of Python:
Python 3.1 (r31:73572, Jul 18 2009, 08:33:59) 
[GCC 4.3.3] on linux2

uname -a: Linux lin-wpl 2.6.28-13-generic #45-Ubuntu SMP Tue Jun 30
19:49:51 UTC 2009 i686 GNU/Linux

Do I have to replace the line:  
            self.c.bind('<Control-Key-' + str(i) + '>',
                lambda x=str(i): self.key_control_num(x))

with something different? str->unicode, bytes???

This does not help either:
bytes("<Control-Key-" + str(i) + ">", 'utf-8')

This program has been converted via 2to3.

----------
components: Tkinter
files: tkpy_70.py
messages: 90656
nosy: wplappert
severity: normal
status: open
title: UnicodeDecodeError: 'utf8' codec can't decode bytes in position 0-1: illegal encoding
versions: Python 3.1
Added file: http://bugs.python.org/file14517/tkpy_70.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6512>
_______________________________________


More information about the Python-bugs-list mailing list