The json module raises a ValueError if load() encounters a problem with the data, but the simplejson module raises a JSONDecodeError exception, which is not present in the json module. Therefore, check for ValueError first to avoid an attribute error.
Signed-off-by: Thomas Wood <[email protected]> --- framework/results.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/framework/results.py b/framework/results.py index 5819af5..f1b1b50 100644 --- a/framework/results.py +++ b/framework/results.py @@ -167,6 +167,13 @@ class TestrunResult(object): with open(os.path.join(results_dir, 'tests', file_), 'r') as f: try: test = json.load(f) + # The json module raises a ValueError if load() encounters a + # problem with the data, but the simplejson module raises a + # JSONDecodeError exception, which is not present in the json + # module. Therefore, check for ValueError first to avoid an + # attribute error. + except ValueError: + continue except json.JSONDecodeError: continue # XXX: There has to be a better way to get a single key: value out -- 2.1.0 _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
