test-fullautomation / robotframework-qconnect-base

Apache License 2.0
2 stars 1 forks source link

[ssh_client.py] UnicodeDecodeError: 'utf-8' codec can't decode byte #9

Closed test-fullautomation closed 2 years ago

test-fullautomation commented 2 years ago

Action:

Try to catch response block from SSH connection with Verify Keyword

Observation:

UnicodeDecodeError error triggered if SSH response contains none utf-8 content

Log:

20220419 09:39:37.512 - DEBUG - Completed SSHClient.wait_4_trace()
20220419 09:39:37.512 - INFO - Exception in thread SSHClient-1:
Traceback (most recent call last):
File "threading.py", line 950, in _bootstrap_inner
File "threading.py", line 888, in run
File "C:\Program Files\RobotFramework\python39\Lib\site-packages\robotframework_qconnect_baselibrary-1.0.0-py3.9.egg\QConnectionLibrary\tcp\ssh\ssh_client.py", line 101, in _thrd_llrecv_from_connection_interface
data = data + recv.decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe2 in position 0: unexpected end of data
20220419 09:39:37.517 - FAIL - Unable to match the pattern after '15' seconds.
20220419 09:39:37.517 - DEBUG - Traceback (most recent call last):
File "C:\Program Files\RobotFramework\python39\Lib\site-packages\robotframework_qconnect_baselibrary-1.0.0-py3.9.egg\QConnectionLibrary\connection_manager.py", line 332, in verify
return self.verify_named_args(**kwargs)
File "C:\Program Files\RobotFramework\python39\Lib\site-packages\robotframework_qconnect_baselibrary-1.0.0-py3.9.egg\QConnectionLibrary\connection_manager.py", line 348, in verify_named_args
return self.verify_unnamed_args(params.conn_name,
File "C:\Program Files\RobotFramework\python39\Lib\site-packages\robotframework_qconnect_baselibrary-1.0.0-py3.9.egg\QConnectionLibrary\connection_manager.py", line 378, in verify_unnamed_args
raise AssertionError("Unable to match the pattern after '%s' seconds." % timeout)

Note:

Possible bugfix already successful tried out:
    added 'ignore' parameter to ssh_client.py:

        old:  Line 101: data = data + recv.decode(‘utf-8’)
        new: Line 101: data = data + recv.decode(‘utf-8’, ‘ignore’  )
test-fullautomation commented 2 years ago

Hi Cuong, please look into this. Thank you, Thomas