mohabusama/pyguacamole

TypeError: a bytes-like object is required, not 'str'

Closed this issue · 7 comments

env python3.5
image

python2.7 ok

@lichao0x7cc Thanks for the report. Could you please provide the full stacktrace?

Traceback (most recent call last):
  File "/home/lichao/qcec_venv/lib/python3.5/site-packages/tornado/websocket.py", line 494, in _run_callback
    result = callback(*args, **kwargs)
  File "/home/lichao/qcec_test/qcec_console_ws/api/v1/assist/newapi.py", line 85, in open
    self.guacamole_client.handshake(protocol='ssh', hostname='172.16.103.149', username='root', password='111111', port=22)
  File "/home/lichao/qcec_venv/lib/python3.5/site-packages/guacamole/client.py", line 158, in handshake
    self.send_instruction(Instruction('select', protocol))
  File "/home/lichao/qcec_venv/lib/python3.5/site-packages/guacamole/client.py", line 136, in send_instruction
    return self.send(instruction.encode())
  File "/home/lichao/qcec_venv/lib/python3.5/site-packages/guacamole/client.py", line 122, in send
    self.client.sendall(data)
TypeError: a bytes-like object is required, not 'str'

Hi @lichao0x7cc , thanks for the details. Will work on a fix and release a new version. Unfortunately, Python3 tests were not accurate and not properly tested.

Hi @mohabusama , thank you your project, it helps too much. But I found when I use py3.6, this project prompts me: "TypeError: a bytes-like object is required, not 'str'". I am trying to modify your code, but it still not work correctly. Can you fix this bug? Thank you very much.

@stone2014 apologies for the late response 😞
I will start working on this one today.

@stone2014 @lichao0x7cc I have released a new version for pyguacamole (0.8)

I have tested against python 2.7 and 3.6 and it is working fine.
Please give it a try and let me know if you still face this issue.