13

Running code in python, I discovered a "Broken Pipe Error." Can someone please explain to me what this is simply?

Thanks.

louie mcconnell
  • 701
  • 3
  • 7
  • 20
  • It means that your program tried to write to a pipe (presumably connected between two processes, but you can have a pipe in a single process), but there wasn't a process left that was able to read from the pipe, so you got the 'broken pipe' error. – Jonathan Leffler Jun 08 '14 at 23:48

1 Answers1

27

A pipe connects two processes. One of these processes holds the read-end of the pipe, and the other holds the write-end.

When the pipe is written to, data is stored in a buffer waiting for the other processes to retrieve it.

What happens if a process is writing to a pipe, but the process on the other side suddenly exits or closes the pipe? Or the other way round, a process is reading just as the writer finishes or closes?

This input/output error is called a broken pipe.

salezica
  • 74,081
  • 25
  • 105
  • 166
  • 1
    The error can't be _fixed_ because it's just a symptom. It's telling you there's another problem. One of the two processes is closing the pipe before it should (perhaps by terminating), or the expectations of the other process are wrong. The broken pipe is not the error, it's the mismatch in process life-cycle. They are not working together correclty – salezica Jan 25 '17 at 20:40
  • so, there is no fix...that's a bummer. – Zld Productions Jan 25 '17 at 20:41
  • Thank you for your help, slezica. I thought it was just a problem with my IDE or something. – Zld Productions Jan 25 '17 at 20:47