load_data raises an exception when parsing invalid JSON

Bug #1762073 reported by Bob Haddleton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
YAQL
Fix Released
Undecided
Bob Haddleton

Bug Description

In python3.4 the @load command raises an AttributeError exception when trying to parse invalid JSON:

Traceback (most recent call last):
  File "/home/bobh/git/yaql/yaql/cli/cli_functions.py", line 101, in load_data
    data = json.loads(json_str)
  File "/usr/local/lib/python3.4/json/__init__.py", line 318, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.4/json/decoder.py", line 343, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.4/json/decoder.py", line 361, in raw_decode
    raise ValueError(errmsg("Expecting value", s, err.value)) from None
ValueError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/bobh/git/yaql/yaql/tests/test_miscellaneous.py", line 106, in test_load_data
    self.assertIsNone(load_data(f.name, context))
  File "/home/bobh/git/yaql/yaql/cli/cli_functions.py", line 103, in load_data
    print('Unable to parse data: ' + e.message)
AttributeError: 'ValueError' object has no attribute 'message'

The ValueError exception from json.loads() does not have a message attribute

Changed in yaql:
assignee: nobody → Bob Haddleton (bob-haddleton)
status: New → In Progress
Revision history for this message
Bob Haddleton (bob-haddleton) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on yaql (master)

Change abandoned by "Takashi Kajinami <email address hidden>" on branch: master
Review: https://review.opendev.org/c/openstack/yaql/+/559503
Reason: I've squashed this to https://review.opendev.org/c/openstack/yaql/+/486054

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to yaql (master)

Reviewed: https://review.opendev.org/c/openstack/yaql/+/486054
Committed: https://opendev.org/openstack/yaql/commit/be3059e2ef50805cb4e6c5e93e1c38b7235df740
Submitter: "Zuul (22348)"
Branch: master

commit be3059e2ef50805cb4e6c5e93e1c38b7235df740
Author: kavithahr <email address hidden>
Date: Fri Jul 21 14:29:37 2017 +0530

    Stop using deprecated 'message' attribute in Exception

    The 'message' attribute has been deprecated and removed
    from Python3.
    For more details, please check:
    https://www.python.org/dev/peps/pep-0352/

    Co-Authored-By: Bob Haddleton <email address hidden>
    Closes-Bug: #1762073
    Change-Id: I655fb3471c6e78fd21f653c55067f79fad778406

Changed in yaql:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/yaql 2.0.1

This issue was fixed in the openstack/yaql 2.0.1 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.