From 704c2a08980a9176e6010570324f18c0569d0a03 Mon Sep 17 00:00:00 2001 From: Erik Johnson Date: Fri, 11 Sep 2015 08:53:58 -0500 Subject: [PATCH] Fix traceback when simplejson < 2.1.0 is installed See https://issues.apache.org/jira/browse/LIBCLOUD-714. --- libcloud/pricing.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libcloud/pricing.py b/libcloud/pricing.py index cc2506f133..42075fb141 100644 --- a/libcloud/pricing.py +++ b/libcloud/pricing.py @@ -23,7 +23,11 @@ try: import simplejson as json - JSONDecodeError = json.JSONDecodeError + try: + JSONDecodeError = json.JSONDecodeError + except AttributeError: + # simplejson < 2.1.0 does not have the JSONDecodeError exception class + JSONDecodeError = ValueError except ImportError: import json JSONDecodeError = ValueError