You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error handling request
Traceback (most recent call last):
File "C:\Users\vboxuser\AppData\Local\Programs\Python\Python310\lib\site-packages\hsds\util\arrayUtil.py", line 419, in readElement
e = np.frombuffer(bytes(e_buffer), dtype=vlen)
ValueError: cannot create an OBJECT array from memory buffer
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\vboxuser\AppData\Local\Programs\Python\Python310\lib\site-packages\aiohttp\web_protocol.py", line 452, in _handle_request
resp = await request_handler(request)
File "C:\Users\vboxuser\AppData\Local\Programs\Python\Python310\lib\site-packages\aiohttp\web_app.py", line 543, in _handle
resp = await handler(request)
File "C:\Users\vboxuser\AppData\Local\Programs\Python\Python310\lib\site-packages\hsds\chunk_dn.py", line 277, in PUT_Chunk
input_arr = bytesToArray(input_bytes, select_dt, [num_elements, ])
File "C:\Users\vboxuser\AppData\Local\Programs\Python\Python310\lib\site-packages\hsds\util\arrayUtil.py", line 500, in bytesToArray
offset = readElement(data, offset, arr, index, dt)
File "C:\Users\vboxuser\AppData\Local\Programs\Python\Python310\lib\site-packages\hsds\util\arrayUtil.py", line 422, in readElement
raise ValueError(msg)
ValueError: e_buffer: b'one: \xe4\xb8\x80', dtype: object
got exception: 'charmap' codec can't encode character '\u4e00' in position 36: character maps to <undefined>
shutting down server
This looks like another case of Windows defaulting to the 1252 encoding instead of UTF-8.
The text was updated successfully, but these errors were encountered:
Adding Content-Type: application/json; charset=utf-8 to the requests headers before the request is made fixes this.
If clients want their data to be parsed correctly, it seem they'll have to do this on their side, since the decoding occurs when request.json() is invoked, and that doesn't take an encoding parameter after the server receives it.
Regardless, HSDS should certainly be able to handle this more gracefully. Wrapping request.json() in a try-except block doesn't prevent an exception from being raised to the HSDS application level, which is strange.
Test to replicate the error (on
windows-latest
or Windows 10):Output from HSDS:
This looks like another case of Windows defaulting to the 1252 encoding instead of UTF-8.
The text was updated successfully, but these errors were encountered: