supybot (0.83.4.1.ds-2) direct (non packaging) changes

Summary

 plugins/Google/plugin.py |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

    
download this patch

Patch contents

--- supybot-0.83.4.1.ds.orig/plugins/Google/plugin.py
+++ supybot-0.83.4.1.ds/plugins/Google/plugin.py
@@ -42,15 +42,21 @@
 import supybot.ircutils as ircutils
 import supybot.callbacks as callbacks
 
+simplejson = None
+
+try:
+    simplejson = utils.python.universalImport('json')
+except ImportError:
+    pass
+
 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
+    if simplejson is None or hasattr(simplejson, 'read'):
+        simplejson = utils.python.universalImport('simplejson',
+                                                  'local.simplejson')
 except ImportError:
     raise callbacks.Error, \
             'You need Python2.6 or the simplejson module installed to use ' \