Menu

#2 keysyms.py causes crashing of readline module with IT keyb

open
nobody
None
5
2014-07-06
2006-05-02
Anonymous
No

When importing readline.py on a Windows XP machine
(python 2.3 or 2.4) the following happens:

Exception exceptions.AttributeError: "'Console' object
has no attribute
'saveatt
r'" in <bound method Console.__del__ of
<readline.Console.Console
object at 0x00
BB5E10>> ignored
VkKeyScan("`") = -1
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File
"C:\Python24\Lib\site-packages\readline\__init__.py",
line 1, in
?
from PyReadline import *
File
"C:\Python24\Lib\site-packages\readline\PyReadline.py",
line
1091, in ?
rl = Readline()
File
"C:\Python24\Lib\site-packages\readline\PyReadline.py",
line 46,
in __ini
t__
self.emacs_editing_mode(None)
File
"C:\Python24\Lib\site-packages\readline\PyReadline.py",
line
1008, in ema
cs_editing_mode
self._bind_key('"%s"' % chr(c), self.self_insert)
File
"C:\Python24\Lib\site-packages\readline\PyReadline.py",
line
1000, in _bi
nd_key
keyinfo = key_text_to_keyinfo(key)
File
"C:\Python24\Lib\site-packages\readline\keysyms.py",
line 101,
in key_tex
t_to_keyinfo
return keyseq_to_keyinfo(keytext[1:-1])
File
"C:\Python24\Lib\site-packages\readline\keysyms.py",
line 163,
in keyseq_
to_keyinfo
res.append(char_to_keyinfo(keyseq[0], control, meta,
shift))
File
"C:\Python24\Lib\site-packages\readline\keysyms.py",
line 111,
in char_to
_keyinfo
raise ValueError, 'bad key'
ValueError: bad key

An example of error occurrence and a quick-and-dirty
fix has been found on this thread:
http://www.thescripts.com/forum/thread42639.html

The fix is patching char_to_keyinfo with these lines:
vk = VkKeyScan(ord(char))
if vk == -1: # ugly fix for backtips
vk = 96

This way readline.py loads correctly, but the .
(period) character does not work: the keyboard
beeps,instead (I don't know if this is an unrelated
issue, a side-effect of the fix or what).

You can find me at: massimo.sandal@unibo.it

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.