I am creating a short python script which requires me to send text back and forth between two computers via sockets. Now when I try to test my application locally on the same computer using telnet and it requires me to use the 'utf-8' encoding when I use the bytes() function as such:
connection.sendall(bytes("Unknown command", 'UTF-8'))
All works well locally, but when I try to test my application remotely on a raspberry pi and connect my computer through telnet I get the following error
TypeError: str() takes at most 1 argument (2 given)
After a bit of research I found that if I remove the utf encoding it will work remotely as such:
connection.sendall(bytes("Unknown command"))
But then this causes an error when I test locally. It says I must use an encoding. Why is this happening?