mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-30 06:49:24 +01:00
Google: Ensure we don't try to use the 3rd party json module.
json-py provides a different interface than simplejson (renamed json when included with Python2.6). As such, we test for the different interface and raise an error when we encounter it. Signed-off-by: James Vega <jamessan@users.sourceforge.net>
This commit is contained in:
parent
cca36ed9f2
commit
d7dee482ca
@ -45,6 +45,12 @@ import supybot.callbacks as callbacks
|
|||||||
try:
|
try:
|
||||||
simplejson = utils.python.universalImport('json', 'simplejson',
|
simplejson = utils.python.universalImport('json', 'simplejson',
|
||||||
'local.simplejson')
|
'local.simplejson')
|
||||||
|
# The 3rd party simplejson module was included in Python 2.6 and renamed to
|
||||||
|
# json. Unfortunately, this conflicts with the 3rd party json module.
|
||||||
|
# Luckily, the 3rd party json module has a different interface so we test
|
||||||
|
# to make sure we aren't using it.
|
||||||
|
if hasattr(simplejson, 'read'):
|
||||||
|
raise ImportError
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise callbacks.Error, \
|
raise callbacks.Error, \
|
||||||
'You need Python2.6 or the simplejson module installed to use ' \
|
'You need Python2.6 or the simplejson module installed to use ' \
|
||||||
|
Loading…
Reference in New Issue
Block a user