Project

General

Profile

HTSP Python example error

Added by Tom Butler over 8 years ago

I don't have any experience with python but wanted to get the example running so I can port it to node, however, I can't get it working. I just added this to the end of the example htsp.py to get it to connect:

client = HTSPClient(('host', '9982') );
client.hello();

This gives me

Traceback (most recent call last):
  File "htsp.py", line 113, in <module>
    client.hello();
  File "htsp.py", line 80, in hello
    self.send('hello', args)
  File "htsp.py", line 65, in send
    self._sock.send(htsmsg.serialize(args))
TypeError: a bytes-like object is required, not 'str'

I'm trying to port it.. but without a working example it's difficult! It's probably a very simple problem but my python knowledge is non-existent.


Replies (1)

RE: HTSP Python example error - Added by James Simpson over 8 years ago

I'm not seeing this issue. I've just grabbed master as is. Added the two lines above to the end of the htsp.py file and executed. Nothing is returned on screen but I can see in the server log that the client connected and then disconnected.

Not sure which copy of the htsp.py file you are using as my line 65 doesn't match up to the one in your message.

    (1-1/1)