How do I translate Ruby's IO.popen calls into Python's subprocess.Popen calls?

Posted by Tom Morris on Stack Overflow See other posts from Stack Overflow or by Tom Morris
Published on 2010-03-27T20:55:53Z Indexed on 2010/03/27 21:03 UTC
Read the original article Hit count: 496

Filed under:
|
|
|
|

I've read the documentation and I've tried lots of things in the REPL, and Googled, but I can't for the life of me understand how subprocess.Popen works in Python.

Here is some Ruby code I am using:

IO.popen("some-process") do |io|
  while(line = io.gets)
    # do whatever with line
  end
end

How do I translate this into Python using subprocess.Popen?

© Stack Overflow or respective owner

Related posts about python

Related posts about ruby