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
In Progress
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 :
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.