By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,818 Members | 1,223 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,818 IT Pros & Developers. It's quick & easy.

issues installing readine-1.12 on WinXP

P: n/a
I have installed Gary Bishop's readline library and Thomas
Heller's cypes; I have Python 2.4 ActiveState distribution.
When I try to import readline I get the following error:

ActivePython 2.4 Build 243 (ActiveState Corp.) based on
Python 2.4 (#60, Nov 30 2004, 09:34:21) [MSC v.1310 32 bit (Intel)] on
Type "help", "copyright", "credits" or "license" for more information.
VkKeyScan("`") = -1
import readline

Exception exceptions.AttributeError: "'Console' object has no attribute
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\", line 1, in
from PyReadline import *
File "C:\Python24\Lib\site-packages\readline\", line
1091, in ?
rl = Readline()
File "C:\Python24\Lib\site-packages\readline\", line 46,
in __ini
File "C:\Python24\Lib\site-packages\readline\", line
1008, in ema
self._bind_key('"%s"' % chr(c), self.self_insert)
File "C:\Python24\Lib\site-packages\readline\", line
1000, in _bi
keyinfo = key_text_to_keyinfo(key)
File "C:\Python24\Lib\site-packages\readline\", line 101,
in key_tex
return keyseq_to_keyinfo(keytext[1:-1])
File "C:\Python24\Lib\site-packages\readline\", line 163,
in keyseq_
res.append(char_to_keyinfo(keyseq[0], control, meta, shift))
File "C:\Python24\Lib\site-packages\readline\", line 111,
in char_to
raise ValueError, 'bad key'
ValueError: bad key

Any hints on what is causing this and the cure?

Michele Simionato

Jul 18 '05 #1
Share this Question
Share on Google+
5 Replies

P: n/a
That shouldn't happen AFAICT. Check line 108 in and make
sure it says "vk = VkKeyScan(ord(char))".

Jul 18 '05 #2

P: n/a
That line seems right. The function is

def char_to_keyinfo(char, control=False, meta=False, shift=False):
vk = VkKeyScan(ord(char))
if vk & 0xffff == 0xffff:
print 'VkKeyScan("%s") = %x' % (char, vk)
raise ValueError, 'bad key'
if vk & 0x100:
shift = True
if vk & 0x200:
control = True
if vk & 0x400:
meta = True
return (control, meta, shift, vk & 0xff)

Maybe the problem is related to the fact that I am using the Italian

Jul 18 '05 #3

P: n/a
Possibly. Is the ` sign available as an unmodified key?

Jul 18 '05 #4

P: n/a
No, I don't even know how to get it under Windows (usually I use
Linux). Switching to the US keyboard
does not help, anyway. I get the same error.


Jul 18 '05 #5

P: n/a
Well, this is ugly as the sin but it seems to work, at least for the

vk = VkKeyScan(ord(char))
if vk == -1: # ugly fix for backtips
vk = 96

I will write to Gary Bishop to point out this issue with the Italian
keyboard and see if he has some decent

Michele Simonato

Jul 18 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.