From: Alex Hall on
Hi all,
In the same program I wrote about yesterday, I have a dictionary of
keystrokes which are captured. I just tried adding a new one, bringing
the total to 11. Here are entries 10 and 11; 10 has been working fine
for months.

10 : (57, win32con.MOD_CONTROL),
11 : (99, win32con.MOD_CONTROL | win32con.MOD_SHIFT)

Now, though, when I press ctrl-shift-c (keystroke 11), nothing
happens. Pressing any other keystroke after that will crash the
program with some sort of Python internal com server exception that I
have never seen before. When set to a keystroke I already use, such as
#10, the function called by #11 works just fine. Does anyone see a
problem with the above syntax? The trouble almost definitely has to be
there; again, using an already-working keystroke instead of making a
new one works perfectly, it is just when I add this new one that
things break.

--
Have a great day,
Alex (msg sent from GMail website)
mehgcap(a)gmail.com; http://www.facebook.com/mehgcap
From: Ulrich Eckhardt on
Alex Hall wrote:
> Now, though, when I press ctrl-shift-c (keystroke 11), nothing
> happens.

Control-C sends a special signal to the console, like Control-Break.

> Pressing any other keystroke after that will crash the program
> with some sort of Python internal com server exception that I
> have never seen before.

Neither do I, in particular since you don't share that rare gem with us. ;)

Uli

--
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932

From: Alex Hall on
I know ctrl-c kills a process in the shell, but these are global
hotkeys and all others work fine. You made me discover something,
though: the error only happens if ctrl-shift-c is pressed when in the
shell from where the program was run; when pressed anywhere else, the
keystroke does nothing at all. Is there something I am missing about
these keystroke dictionaries? It seems like they do not work unless
the keycodes are in numerical order and are not separated by more than
one number. Currently, my dictionary consists of the numbers 1-0 on
the top of the keyboard, but adding any other keycode, like the 99 in
my original message, will cause that keystroke to do absolutely
nothing. Thanks to your response, I suspect the problem is something
to do with the keypress being captured by the shell. Still, not being
able to use anything except numbers is very annoying!! Why would this
be happening?


On 3/9/10, Ulrich Eckhardt <eckhardt(a)satorlaser.com> wrote:
> Alex Hall wrote:
>> Now, though, when I press ctrl-shift-c (keystroke 11), nothing
>> happens.
>
> Control-C sends a special signal to the console, like Control-Break.
>
>> Pressing any other keystroke after that will crash the program
>> with some sort of Python internal com server exception that I
>> have never seen before.
>
> Neither do I, in particular since you don't share that rare gem with us. ;)
>
> Uli
>
> --
> Sator Laser GmbH
> Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>


--
Have a great day,
Alex (msg sent from GMail website)
mehgcap(a)gmail.com; http://www.facebook.com/mehgcap
From: Tim Golden on
On 09/03/2010 13:55, Alex Hall wrote:
> Hi all,
> In the same program I wrote about yesterday, I have a dictionary of
> keystrokes which are captured. I just tried adding a new one, bringing
> the total to 11. Here are entries 10 and 11; 10 has been working fine
> for months.
>
> 10 : (57, win32con.MOD_CONTROL),
> 11 : (99, win32con.MOD_CONTROL | win32con.MOD_SHIFT)
>
> Now, though, when I press ctrl-shift-c (keystroke 11)

Ctrl-C (with or without any other modifier) has a special meaning
which overrides any hotkeys. You may be able to do something by
adding a break handler through SetConsoleCtrlHandler (exposed in
win32api). But it would obviously be a special case outside your
normal control flow.

TJG
From: Tim Golden on
On 09/03/2010 16:34, Tim Golden wrote:
> On 09/03/2010 13:55, Alex Hall wrote:
>> Hi all,
>> In the same program I wrote about yesterday, I have a dictionary of
>> keystrokes which are captured. I just tried adding a new one, bringing
>> the total to 11. Here are entries 10 and 11; 10 has been working fine
>> for months.
>>
>> 10 : (57, win32con.MOD_CONTROL),
>> 11 : (99, win32con.MOD_CONTROL | win32con.MOD_SHIFT)
>>
>> Now, though, when I press ctrl-shift-c (keystroke 11)
>
> Ctrl-C (with or without any other modifier) has a special meaning
> which overrides any hotkeys. You may be able to do something by
> adding a break handler through SetConsoleCtrlHandler (exposed in
> win32api). But it would obviously be a special case outside your
> normal control flow.

.... or you could use SetConsoleMode to disable input processing. But
that would only work (I think) in one console, not at a global level.

TJG