Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #74507

multiprocessing problem: queue.get() not finding pushed values

Date 2014-07-15 13:32 -0700
From Charles Hixson <charleshixsn@earthlink.net>
Subject multiprocessing problem: queue.get() not finding pushed values
Newsgroups comp.lang.python
Message-ID <mailman.11848.1405456555.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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


Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

multiprocessing problem:  queue.get() not finding pushed values Charles Hixson <charleshixsn@earthlink.net> - 2014-07-15 13:32 -0700

csiph-web