Python: unix socket -> broken pipe
Posted
by Heinrich Schmetterling
on Stack Overflow
See other posts from Stack Overflow
or by Heinrich Schmetterling
Published on 2010-04-26T21:31:36Z
Indexed on
2010/04/26
21:33 UTC
Read the original article
Hit count: 452
I'm trying to get Python socket working as an alternative to calling the command line socat.
This socat command works fine:
echo 'cmd' | sudo socat stdio <path-to-socket>
but when I run this python code, I get an error:
>>> import socket
>>> s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
>>> s.connect(<path-to-socket>)
>>> s.send('cmd')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
socket.error: (32, 'Broken pipe')
Any ideas what the issue is? Thanks.
© Stack Overflow or respective owner