Ioerror: [Errno 32] Broken Pipe When Piping: 'Prog.Py | Othercmd'

IOError: [Errno 32] Broken pipe when piping: `prog.py | othercmd`

I haven't reproduced the issue, but perhaps this method would solve it: (writing line by line to stdout rather than using print)

import sys
with open('a.txt', 'r') as f1:
for line in f1:
sys.stdout.write(line)

You could catch the broken pipe? This writes the file to stdout line by line until the pipe is closed.

import sys, errno
try:
with open('a.txt', 'r') as f1:
for line in f1:
sys.stdout.write(line)
except IOError as e:
if e.errno == errno.EPIPE:
# Handle error

You also need to make sure that othercommand is reading from the pipe before it gets too big - https://unix.stackexchange.com/questions/11946/how-big-is-the-pipe-buffer

Python3 - [Errno 32] Broken Pipe while using sockets

your server is closing the port immediately after a single recv. I'd suggest changing your handle_client code to have some sort of while loop that ends when recv returns an empty string (this indicates the client has shutdown their end of the connection, probably by closeing their connection)

IOError: [Errno 32] Broken pipe when saving animation files in anaconda python

Get it solved by myself! I use conda install to get ffmpeg but when using ffmpeg --version will always say that:

libssl.so.10: cannot open shared object file: No such file or directory

so I use:

sudo ln -s /home/xin/anaconda2/lib/libssl.so.1.0.0 libssl.so.10

Then get similar problem about libcrypto.so.10, so I use:

sudo ln -s /home/xin/anaconda2/lib/libcrypto.so.1.0.0 libcrypto.so.10

The two files are in /lib/x86_64-linux-gnu.

Now things work!! I know some people also have similar problems, so I record it here.

In future, if need to remove the link:

cd /lib/x86_64-linux-gnu
sudo unlink libssl.so.10
sudo unlink libcrypto.so.10


Related Topics



Leave a reply



Submit