mohabusama / pyguacamole

Guacamole Python Client
MIT License
108 stars 34 forks source link

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

Closed l1ch40 closed 5 years ago

l1ch40 commented 6 years ago

env python3.5 image

l1ch40 commented 6 years ago

python2.7 ok

mohabusama commented 6 years ago

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

l1ch40 commented 6 years ago
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'
mohabusama commented 6 years ago

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.

stone2014 commented 5 years ago

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.

mohabusama commented 5 years ago

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

mohabusama commented 5 years ago

@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.