Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upscylla-housekeeping should read json as utf-8 string for older python versions #4239
Comments
penberg
added a commit
that referenced
this issue
Feb 20, 2019
…patibility Python 3.6 is the first version to accept bytes to the json.loads(), which causes the following error on older Python 3 versions: Traceback (most recent call last): File "/usr/lib/scylla/scylla-housekeeping", line 175, in <module> args.func(args) File "/usr/lib/scylla/scylla-housekeeping", line 121, in check_version raise e File "/usr/lib/scylla/scylla-housekeeping", line 116, in check_version versions = get_json_from_url(version_url + params) File "/usr/lib/scylla/scylla-housekeeping", line 55, in get_json_from_url return json.loads(data) File "/usr/lib64/python3.4/json/__init__.py", line 312, in loads s.__class__.__name__)) TypeError: the JSON object must be str, not 'bytes' To support those older Python versions, convert the bytes read to utf8 strings before calling the json.loads(). Fixes #4239 Branches: master, 3.0 Signed-off-by: Amnon Heiman <amnon@scylladb.com> Message-Id: <20190218112312.24455-1-amnon@scylladb.com> (cherry picked from commit 750b76b)
avikivity
added a commit
that referenced
this issue
Feb 20, 2019
…patibility Python 3.6 is the first version to accept bytes to the json.loads(), which causes the following error on older Python 3 versions: Traceback (most recent call last): File "/usr/lib/scylla/scylla-housekeeping", line 175, in <module> args.func(args) File "/usr/lib/scylla/scylla-housekeeping", line 121, in check_version raise e File "/usr/lib/scylla/scylla-housekeeping", line 116, in check_version versions = get_json_from_url(version_url + params) File "/usr/lib/scylla/scylla-housekeeping", line 55, in get_json_from_url return json.loads(data) File "/usr/lib64/python3.4/json/__init__.py", line 312, in loads s.__class__.__name__)) TypeError: the JSON object must be str, not 'bytes' To support those older Python versions, convert the bytes read to utf8 strings before calling the json.loads(). Fixes #4239 Branches: master, 3.0 Signed-off-by: Amnon Heiman <amnon@scylladb.com> Message-Id: <20190218112312.24455-1-amnon@scylladb.com> (cherry picked from commit 750b76b)
amoskong
pushed a commit
to amoskong/scylla
that referenced
this issue
May 8, 2019
…patibility Python 3.6 is the first version to accept bytes to the json.loads(), which causes the following error on older Python 3 versions: Traceback (most recent call last): File "/usr/lib/scylla/scylla-housekeeping", line 175, in <module> args.func(args) File "/usr/lib/scylla/scylla-housekeeping", line 121, in check_version raise e File "/usr/lib/scylla/scylla-housekeeping", line 116, in check_version versions = get_json_from_url(version_url + params) File "/usr/lib/scylla/scylla-housekeeping", line 55, in get_json_from_url return json.loads(data) File "/usr/lib64/python3.4/json/__init__.py", line 312, in loads s.__class__.__name__)) TypeError: the JSON object must be str, not 'bytes' To support those older Python versions, convert the bytes read to utf8 strings before calling the json.loads(). Fixes scylladb#4239 Branches: master, 3.0 Signed-off-by: Amnon Heiman <amnon@scylladb.com> Message-Id: <20190218112312.24455-1-amnon@scylladb.com> (cherry picked from commit 750b76b)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Python 3 versions prior to 3.6 does not support loading json objects from bytes, and needs that it will be converted to string first