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.