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
When Gears loads a saved journal object, no gears are shown, and Sugar
shell.log contains;
Traceback (most recent call last):
File "jarabe/apisocket.py", line 327, in _message_received_cb
stream_id = ord(message.data[0])
TypeError: ord() expected string of length 1, but int found
Comparing the type of data between Sugar Live Build with Sugar 0.117
running Python 3 and OLPC OS 18.04 running Python 2:
(1) Python 3, stream_id type is int
(2) Python 2, stream_id type is str
` Type of streamid: <type 'str'> `
` Ord(stream_id) type: <type 'int'> `
stream_id is supposed to be an Int, ord() is not required in Python 3 as
it was in Python 2, as indexing a bytes buffer yields a string. In
Python 3 it yields an integer.
Also, for data loaded at DatastoreAPI.save.on_data :
(1) Python 3, data type is bytes
` DatastoreAPI.save.on_data(data), data of type: <class 'bytes'> `
` data[1:].decode('utf-8') of type:<class 'str'> `
(2) Python 2, data type is str
` DatastoreAPI.save.on_data(data), data of type: <type 'str'> `
write() function requires parameter of type str because file is text.
In Python 2 the bytes type is the same as the str type. So write() had
no issues with Python 2.
The commit fixes these and data from the Journal loads properly.
Read and write data in binary, so as to avoid conversion to text.
Activity data can be saved and resumed, no issues logged.
Related to
#909
Part of
#911
Regression introduced
aa18879
Signed-off-by: James Cameron <[email protected]>
0 commit comments