Why does this code crash python?

Mythmon at gmail.com Mythmon at gmail.com
Sat Nov 11 15:28:05 EST 2006


On Nov 11, 11:28 am, Irmen de Jong <irmen.NOS... at xs4all.nl> wrote:
> You're creating a console object "c" and use it in both threads.
>
> Try creating the console object for each thread by itself,
> i.e. remove the global "c = Console.getconsole()" and replace
> it by a getconsole() inside each thread class.
>
> I don't have the Console module so I don't know if it fixes things
> for you, but give it a try :)

Well, I tried that, and it did something. It made it so the space bar
switched the clock once, but not a second time. And it still crashed,
but not always at the same time, sometimes it would do it the second
time I hit the space bar, sometimes before I hit it the first time, but
always when i did something that would generate a Console event (moving
the mouse or something). So, I thought it had something to do with
Console not working well with threads, so I took it completely out of
threads and had just the event checking loop run by itself, and it
still crashed. So apparently I am using the Console events wrong. I am
going to try and find some examples online on how to watch for events
with it, but if worse comes to worse I can try and use keyboard hooks,
I've looked at those before, and they might work better.

--Mythmon




More information about the Python-list mailing list