Opened 5 years ago

Closed 17 months ago

#2270 closed defect (wontfix)

Rasdapy3 --out string gives error when used with binary data

Reported by: apercov Owned by: apercov
Priority: minor Milestone: Future
Component: rasdapy Version: 9.8
Keywords: Cc: Dimitar Misev
Complexity: Medium

Description

Running following query

/home/apercov/rasdaman/systemtest/testcases_mandatory/test_rasdapy3/rasql.py --server localhost --port 7001 --user rasadmin --passwd rasadmin --database /opt/rasdaman/data/RASBASE -q 'select c from test_cfloat32 as c ' --out string

I receive the following output:

b'\x00\x00`B\x00\x00LB\x00\x00\x98A\x00\x00\x10A\x00\x00\x0cB\x00\x00\xb8\xc1\x00\x00\x8e\xc2\x00\x00\\\xc2\x00\x00\xc0\xc0\x00\x00\xd0\xc1\x00\x00(\xc2\x00\x00\xf0\xc1\x00\x00\x00@\x00\x00\x98\xc1\x00\x00p\xc1\x00\x00\x80A\x00\x00`B\x00\x00LB\x00\x00\x98A\x00\x00\x10A\x00\x00\x0cB\x00\x00\xb8\xc1\x00\x00\x8e\xc2\x00\x00\\\xc2\x00\x00\xc0\xc0\x00\x00\xd0\xc1\x00\x00(\xc2\x00\x00\xf0\xc1\x00\x00\x00@\x00\x00\x98\xc1\x00\x00p\xc1\x00\x00\x80A'
rasql done.
Traceback (most recent call last):
  File "/home/apercov/rasdaman/systemtest/testcases_mandatory/test_rasdapy3/rasql.py", line 272, in <module>
    main.execute()
  File "/home/apercov/rasdaman/systemtest/testcases_mandatory/test_rasdapy3/rasql.py", line 156, in execute
    self.__handle_result(res_arr)
  File "/home/apercov/rasdaman/systemtest/testcases_mandatory/test_rasdapy3/rasql.py", line 186, in __handle_result
    self.__handle_result_as_string(res_arr)
  File "/home/apercov/rasdaman/systemtest/testcases_mandatory/test_rasdapy3/rasql.py", line 208, in __handle_result_as_string
    msg = encoded_bytes_to_str(res) if res_arr.is_object else res
  File "/home/apercov/rasdaman/applications/rasdapy3/rasdapy/cores/utils.py", line 414, in encoded_bytes_to_str
    return input.decode().rstrip('\x00')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x98 in position 10: invalid start byte

Rasdapy should print binary data without trying to decode it as Unicode.

Change History (4)

comment:1 by apercov, 5 years ago

Component: undecidedrasdapy

comment:2 by Dimitar Misev, 5 years ago

Milestone: 10.0Future
Priority: majorminor

comment:3 by Dimitar Misev, 5 years ago

Owner: set to apercov
Status: newassigned

comment:4 by Dimitar Misev, 17 months ago

Resolution: wontfix
Status: assignedclosed

rasql.py is just for the systemtests, fixing this behavior is not critical as it's not used in the systemtests.

Note: See TracTickets for help on using tickets.