Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:not': 0.03; 'python3': 0.07; '"__main__":': 0.09; '(self,': 0.09; '*the': 0.09; '__init__': 0.09; '__name__': 0.09; 'msg': 0.09; 'none)': 0.09; 'python': 0.11; 'def': 0.12; '(self):': 0.16; '23,': 0.16; 'collections': 0.16; 'empty,': 0.16; 'message-id:@earthlink.net': 0.16; 'namedtuple': 0.16; 'received:dsl.mindspring.com': 0.16; 'sqlite': 0.16; 'subject:skip:m 10': 0.16; 'subject:values': 0.16; 'trying': 0.19; 'import': 0.22; 'separate': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'skip:{ 20': 0.24; 'subject:problem': 0.24; 'skip:" 40': 0.26; 'code:': 0.26; 'raise': 0.29; "i'm": 0.30; 'file': 0.32; 'class': 0.32; 'this.': 0.32; 'run': 0.32; 'linux': 0.33; 'running': 0.33; '(most': 0.33; 'received:66': 0.35; 'beyond': 0.35; 'but': 0.35; 'skip:& 10': 0.38; 'process,': 0.38; 'to:addr:python-list': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'problems.': 0.60; 'full': 0.61; 'system:': 0.91 Date: Tue, 15 Jul 2014 13:32:08 -0700 From: Charles Hixson User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.5.0 MIME-Version: 1.0 To: Python Subject: multiprocessing problem: queue.get() not finding pushed values Content-Type: multipart/alternative; boundary="------------080708030608040000080905" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 113 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1405456555 news.xs4all.nl 2859 [2001:888:2000:d::a6]:36998 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:74507 This is a multi-part message in MIME format. --------------080708030608040000080905 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit I don't think I can reduce it much beyond this. I'm trying to run Sqlite in a separate process, but I'm running into problems. *The code:* from collections import namedtuple from multiprocessing import Process, Queue, current_process from queue import Empty, Full Msg = namedtuple ("Msg", ['act', 'id', 'vals']) DBW_to = Queue() DBW_from = Queue() class DBW (Process): def __init__ (self, qin, qout): self.qin = qin self.qout = qout super (DBW, self).__init__() def run (self): msg = self.qin.get(True, 3) print ("msg = {0}".format(repr(msg) ) ) if __name__ == "__main__": dbw = DBW(DBW_to, DBW_from) dbw.run() DBW_to.put(Msg("a", 1, wrd) ) DBW_to.put(Msg("b", 2, wrd) ) DBW_to.put(Msg("c", 0, None) ) *The result:* Traceback (most recent call last): File "test7a.py", line 23, in dbw.run() File "test7a.py", line 18, in run msg = self.qin.get(True, 3) File "/usr/lib/python3.4/multiprocessing/queues.py", line 107, in get raise Empty queue.Empty *$ python3 --version* Python 3.4.1 *The system:* Linux 3.14-1-amd64 --------------080708030608040000080905 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit I don't think I can reduce it much beyond this.  I'm trying to run Sqlite in a separate process, but I'm running into problems.
The code:
from collections    import    namedtuple
from multiprocessing import Process, Queue, current_process
from queue import Empty, Full


Msg    =    namedtuple ("Msg", ['act', 'id', 'vals'])
DBW_to    =    Queue()
DBW_from    =    Queue()

class DBW (Process):
    def __init__ (self, qin, qout):
        self.qin    =    qin
        self.qout    =    qout
        super (DBW, self).__init__()

    def run (self):
        msg    =    self.qin.get(True, 3)
        print ("msg = {0}".format(repr(msg) ) )

if __name__ == "__main__":
    dbw    =    DBW(DBW_to, DBW_from)
    dbw.run()
    DBW_to.put(Msg("a", 1, wrd) )
    DBW_to.put(Msg("b", 2, wrd) )
    DBW_to.put(Msg("c", 0, None) )

The result:
Traceback (most recent call last):
  File "test7a.py", line 23, in <module>
    dbw.run()
  File "test7a.py", line 18, in run
    msg    =    self.qin.get(True, 3)
  File "/usr/lib/python3.4/multiprocessing/queues.py", line 107, in get
    raise Empty
queue.Empty


$ python3 --version
Python 3.4.1

The system:
Linux 3.14-1-amd64


--------------080708030608040000080905--