From d7dee482ca13a21aeee5a99082d58383f03b176f Mon Sep 17 00:00:00 2001 From: James Vega Date: Tue, 19 May 2009 00:55:17 -0400 Subject: [PATCH] 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 --- plugins/Google/plugin.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/Google/plugin.py b/plugins/Google/plugin.py index 696c0000e..e1b6bee9e 100644 --- a/plugins/Google/plugin.py +++ b/plugins/Google/plugin.py @@ -45,6 +45,12 @@ import supybot.callbacks as callbacks try: simplejson = utils.python.universalImport('json', '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: raise callbacks.Error, \ 'You need Python2.6 or the simplejson module installed to use ' \