From 82e4826dea52d7c04b9a8676ac2069d316ab535b Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Wed, 17 Oct 2012 02:30:04 +0200 Subject: [PATCH] Fall back to simplejson when the stdlib json module is not available --- crawler/calibre.py | 7 ++++++- crawler/daemon.py | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/crawler/calibre.py b/crawler/calibre.py index b741d4d..d0e362a 100644 --- a/crawler/calibre.py +++ b/crawler/calibre.py @@ -1,8 +1,13 @@ #!/usr/bin/python -import os, time, sys, json, urllib, urllib2, threading, re +import os, time, sys, urllib, urllib2, threading, re from collections import deque from BeautifulSoup import BeautifulSoup +try: + import json +except: + import simplejson as json + STOP = False pipe_name = 'pipe_books' diff --git a/crawler/daemon.py b/crawler/daemon.py index a345603..21dc553 100644 --- a/crawler/daemon.py +++ b/crawler/daemon.py @@ -1,5 +1,10 @@ #!/usr/bin/python -import os, time, sys, json, _mysql +import os, time, sys, _mysql + +try: + import json +except: + import simplejson as json def stringdammit(input_string): if isinstance(input_string, str):