Commit 7b4a1084 by Chris Jerdonek

Added a hack to get around Python bug #7559: http://bugs.python.org/issue7559

parent e1a91258
...@@ -13,7 +13,16 @@ try: ...@@ -13,7 +13,16 @@ try:
except: except:
# The json module is new in Python 2.6, whereas simplejson is # The json module is new in Python 2.6, whereas simplejson is
# compatible with earlier versions. # compatible with earlier versions.
import simplejson as json try:
import simplejson as json
except ImportError:
# Raise an error with a type different from ImportError as a hack around
# this issue:
# http://bugs.python.org/issue7559
from sys import exc_info
ex_type, ex_value, tb = exc_info()
new_ex = Exception("%s: %s" % (ex_type.__name__, ex_value))
raise new_ex.__class__, new_ex, tb
# The optparse module is deprecated in Python 2.7 in favor of argparse. # The optparse module is deprecated in Python 2.7 in favor of argparse.
# However, argparse is not available in Python 2.6 and earlier. # However, argparse is not available in Python 2.6 and earlier.
......
...@@ -24,7 +24,16 @@ except ImportError: ...@@ -24,7 +24,16 @@ except ImportError:
# simplejson is. The simplejson package dropped support for Python 2.4 # simplejson is. The simplejson package dropped support for Python 2.4
# in simplejson v2.1.0, so Python 2.4 requires a simplejson install # in simplejson v2.1.0, so Python 2.4 requires a simplejson install
# older than the most recent version. # older than the most recent version.
import simplejson as json try:
import simplejson as json
except ImportError:
# Raise an error with a type different from ImportError as a hack around
# this issue:
# http://bugs.python.org/issue7559
from sys import exc_info
ex_type, ex_value, tb = exc_info()
new_ex = Exception("%s: %s" % (ex_type.__name__, ex_value))
raise new_ex.__class__, new_ex, tb
file_extension = 'json' file_extension = 'json'
parser = json parser = json
else: else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment