Popen pipe hang

Discussion in 'Python' started by schickb, May 13, 2008.

  1. schickb

    schickb Guest

    I'm trying to pipe data that starts life in an array('B') object
    through several processes. The code below is a simplified example. The
    data makes it through, but the wait() always hangs. Is there a better
    way to indicate src.stdin has reach EOF?

    from subprocess import Popen, PIPE
    from array import array

    arr = array('B')
    arr.fromstring("hello\n")

    src = Popen( ["cat"], stdin=PIPE, stdout=PIPE)
    dst = Popen( ["cat"], stdin=src.stdout)
    arr.tofile(src.stdin)
    src.stdin.close()
    dst.wait()
    schickb, May 13, 2008
    #1
    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. lee, wonsun
    Replies:
    1
    Views:
    478
    Jack Klein
    Nov 2, 2004
  2. Tom Brown
    Replies:
    0
    Views:
    455
    Tom Brown
    Sep 22, 2005
  3. skunkwerk

    popen pipe limit

    skunkwerk, Apr 8, 2008, in forum: Python
    Replies:
    2
    Views:
    507
    skunkwerk
    Apr 10, 2008
  4. Mathieu Prevot
    Replies:
    3
    Views:
    357
    Mathieu Prevot
    May 24, 2008
  5. Replies:
    1
    Views:
    215
    Ben Morrow
    Jun 2, 2004
Loading...

Share This Page