summaryrefslogtreecommitdiffstats
path: root/supybot-0.83.4.1-json.patch
blob: f6606fe3128e4defab261aadfb11ac0f06c2f451 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
diff --git a/plugins/Google/plugin.py b/plugins/Google/plugin.py
index e1b6bee..98fd7dd 100644
--- a/plugins/Google/plugin.py
+++ b/plugins/Google/plugin.py
@@ -42,15 +42,21 @@ import supybot.ircmsgs as ircmsgs
 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 ' \