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


Groups > comp.lang.python > #74531 > unrolled thread

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

Started byChris Angelico <rosuav@gmail.com>
First post2014-07-16 14:26 +1000
Last post2014-07-16 14:26 +1000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: multiprocessing problem: queue.get() not finding pushed values Chris Angelico <rosuav@gmail.com> - 2014-07-16 14:26 +1000

#74531 — Re: multiprocessing problem: queue.get() not finding pushed values

FromChris Angelico <rosuav@gmail.com>
Date2014-07-16 14:26 +1000
SubjectRe: multiprocessing problem: queue.get() not finding pushed values
Message-ID<mailman.11862.1405484811.18130.python-list@python.org>
On Wed, Jul 16, 2014 at 6:32 AM, Charles Hixson
<charleshixsn@earthlink.net> wrote:
> from queue import Empty, Full

Not sure what this is for, you never use those names (and I don't have
a 'queue' module to import from). Dropped that line. In any case, I
don't think it's your problem...

> 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) )

... which is here. You're not starting a subprocess; you're simply
calling a method, so it runs synchronously. When you call .run(), it
runs the "subprocess" to completion, which then bombs because the
queue's empty, and then never gets to putting anything onto it. Change
that .run() to .start() and it'll do as you expect, except that as
part of cutting the example down you seem to have omitted the
definition of wrd. I changed that to a quoted string and it works:

# chomp unchanged code ...
if __name__ == "__main__":
    dbw    =    DBW(DBW_to, DBW_from)
    dbw.start()
    DBW_to.put(Msg("a", 1, 'wrd') )
    DBW_to.put(Msg("b", 2, 'wrd') )
    DBW_to.put(Msg("c", 0, None) )

rosuav@sikorsky:~$ python test7a.py
msg = Msg(act='a', id=1, vals='wrd')

Hope that helps!

ChrisA

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web