introduction and first question about multithreading
My name is Vojta and I am blind student. I am slowly learning Python for
about 4 years and I like it alot, mostly its ability to run on various
My primary system is Ubuntu 12.04, but I have Windows XP at hand. I am
using python 2.7. I have learned basics from the book A byte of Python
(for version 2.X) and something from Dive into Python. But most things I
learned by trial and error and thanks to solutions on stackoverflow.com.
I Don't know much about good programming concepts in Python, just in
general, so feel free to educate me about them.
I haven't created anything great yet, but I am working on a game for
blind people. It is a simple game of reaction, but I have to start with
something, my next plan is Sudoku game.
I am using Pygame for handling of sounds and keyboard events, speech
dispatcher under Linux and pyttsx under Windows to provide speech
output, numpy for sound cutting and my two little and simple modules for
providing menu system and unified interface for both speech engines.
During the development, I discovered, that I have to use multithreading
to be able to check for key presses and manage the game at the same
time. I tried threading module but this wasn't enough for me, because
function running in the separate thread needed to access variables in
the main thread at least I couldn't find the way how to do that. So I
switched to multiprocessing and started using pipes for communication
between processes. All is working well, except for one thing.
My menu module uses a loop to check for keyboard events through pygame.
I don't import pygame into my module directly, but rather pass it
through my main module like this:
menu.pygame = pygame
All was working well until I started using multiprocessing. I may have a
probable cause but I need your help.
In my main module I am running a similar loop for checking keyboard
input in separate process. When a player loses, the loop finishes and I
join the process. Then the menu module kicks in and should launch its
own loop checking for pygame keyboard events, but right after doing it
[xcb] Unknown sequence number while processing queue
[xcb] Most likely this is a multi-threaded client and XInitThreads has
not been called
[xcb] Aborting, sorry about that.
python: ../../src/xcb_io.c:273: poll_for_event: Assertion
received SigAbrt - core dumped
Are atachments allowed here? I can send you my whole code.
Please help me, if you can.
Thank you very much,
Re: introduction and first question about multithreading
In article <firstname.lastname@example.org>,
Vojt®ßch Pol®¢‰ek <email@example.com> wrote:
> Then the menu module kicks in and should launch its
> own loop checking for pygame keyboard events, but right after doing it
> it prints:
> [xcb] Unknown sequence number while processing queue
> [xcb] Most likely this is a multi-threaded client and XInitThreads has
> not been called
> [xcb] Aborting, sorry about that.
I googled for "Unknown sequence number while processing queue" and found:
sounds like it addresses your problem.
|All times are GMT. The time now is 02:33 AM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.