7stud wrote:
> On Jul 2, 2:12 pm, Steve Holden <[EMAIL PROTECTED]> wrote:
>> a) Who told you pipes should be unbuffered by default, and b) what difference
>> does that make anyway?
>>
>
> a) The docs.
>
> b) If the pipes were buffered then writing a small amount of data like
> "text3" to the pipe
7stud wrote:
> On Jul 2, 1:58 pm, Bjoern Schliessmann [EMAIL PROTECTED]> wrote:
>> 7stud wrote:
>>> Thanks for the response. So are you saying that the only way you
>>> can get data out of a pipe is when the subprocess has terminated?
>> No, not only because Pipes aren't related to processes in a
On Jul 2, 2:12 pm, Steve Holden <[EMAIL PROTECTED]> wrote:
> a) Who told you pipes should be unbuffered by default, and b) what difference
> does that make anyway?
>
a) The docs.
b) If the pipes were buffered then writing a small amount of data like
"text3" to the pipe would cause the other side
7stud wrote:
> Why doesn't the following program write to the file?
>
> driver.py
> ---
> import subprocess as sub
>
> p = sub.Popen(["python", "-u", "test1.py"], stdin=sub.PIPE,
> stdout=sub.PIPE)
>
>
> p.stdin.write("text3")
>
> while True:
> pass
> ---
>
> test1.py:
> -
On Jul 2, 2:03 pm, Bjoern Schliessmann wrote:
> 7stud wrote:
> > Why doesn't the following program write to the file?
> > [...]
> > It just hangs, and then when I hit Ctrl+C and look in the file,
> > the data isn't in there.
>
> Also, the pipe may be unbuffered by
> default; file access isn't.
>
On Jul 2, 1:58 pm, Bjoern Schliessmann wrote:
> 7stud wrote:
> > Thanks for the response. So are you saying that the only way you
> > can get data out of a pipe is when the subprocess has terminated?
>
> No, not only because Pipes aren't related to processes in any
> special way.
>
> He said that
7stud wrote:
> Why doesn't the following program write to the file?
> [...]
> It just hangs, and then when I hit Ctrl+C and look in the file,
> the data isn't in there.
I suppose your running child process isn't closed cleanly if you
terminate the parent process. Also, the pipe may be unbuffered
7stud wrote:
> Thanks for the response. So are you saying that the only way you
> can get data out of a pipe is when the subprocess has terminated?
No, not only because Pipes aren't related to processes in any
special way.
He said that you can't write to a pipe whose reader has already
terminat
Why doesn't the following program write to the file?
driver.py
---
import subprocess as sub
p = sub.Popen(["python", "-u", "test1.py"], stdin=sub.PIPE,
stdout=sub.PIPE)
p.stdin.write("text3")
while True:
pass
---
test1.py:
-
import sys
data = sys.stdin.read()
f = open("a
On Jul 2, 11:32 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> On Jul 2, 1:12 pm, 7stud <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi,
>
> > Can someone explain what a broken pipe is? The following produces a
> > broken pipe error:
>
> > --
> > import subprocess as sub
>
> > p = sub.Popen(
On Jul 2, 1:12 pm, 7stud <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Can someone explain what a broken pipe is? The following produces a
> broken pipe error:
>
> --
> import subprocess as sub
>
> p = sub.Popen(["ls", "-al", "../"], stdin=sub.PIPE, stdout=sub.PIPE)
>
> print p.stdout.read()
> #out
Hi,
Can someone explain what a broken pipe is? The following produces a
broken pipe error:
--
import subprocess as sub
p = sub.Popen(["ls", "-al", "../"], stdin=sub.PIPE, stdout=sub.PIPE)
print p.stdout.read()
#outputs the files correctly
p.stdin.write("ls\n")
#IOError: [Errno 32] Bro
12 matches
Mail list logo