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

Charles Hixson charleshixsn at
Tue Jul 15 22:32:08 CEST 2014

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_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 "", line 23, in <module>
   File "", line 18, in run
     msg    =    self.qin.get(True, 3)
   File "/usr/lib/python3.4/multiprocessing/", line 107, in get
     raise Empty

*$ python3 --version*
Python 3.4.1

*The system:*
Linux 3.14-1-amd64

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list