introduction and first question about multithreading

Discussion in 'Python' started by Vojtěch Polášek, Jul 11, 2012.

  1. Greetings,
    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
    platforms.
    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
    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.
    python: ../../src/xcb_io.c:273: poll_for_event: Assertion
    `!xcb_xlib_threads_sequence_lost' failed
    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,
    Vojta
    Vojtěch Polášek, Jul 11, 2012
    #1
    1. Advertising

  2. Vojtěch Polášek

    Roy Smith Guest

    In article <>,
    Vojt®ßch Pol®¢‰ek <> 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:

    http://www.gtkforums.com/viewtopic.php?f=3&t=55708

    sounds like it addresses your problem.
    Roy Smith, Jul 11, 2012
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steven T. Hatton
    Replies:
    1
    Views:
    406
    Steven T. Hatton
    Dec 13, 2006
  2. Pearson & prentice hall solutions
    Replies:
    0
    Views:
    534
    Pearson & prentice hall solutions
    Jun 20, 2009
  3. Replies:
    1
    Views:
    302
  4. Peter Kalvin
    Replies:
    0
    Views:
    1,169
    Peter Kalvin
    Feb 4, 2010
  5. Dave Angel
    Replies:
    0
    Views:
    195
    Dave Angel
    Jul 12, 2012
Loading...

Share This Page