# HG changeset patch # User Atul Varma # Date 1229010746 28800 # Node ID 7fa60aca382d03606eeb532eb1c40b1a7231b16f # Parent c14445b5eee020cb0f5a78c784c692b282b4ad9c More helpful error message if json, simplejson can't be found. diff -r c14445b5eee0 -r 7fa60aca382d hrm.py --- a/hrm.py Thu Dec 11 02:30:54 2008 -0800 +++ b/hrm.py Thu Dec 11 07:52:26 2008 -0800 @@ -1,4 +1,4 @@ -#! /usr/bin/env python3.0 +#! /usr/bin/env python # ---------------------------------------------------------------------------- # Copyright (c) 2006, Atul Varma # All rights reserved. @@ -43,8 +43,6 @@ # # * setup.py script for easy installation. # -# * Python 2.x compatibility. -# # * Unit and/or functional tests; doctests would be really nice. # # * If the '-f' parameter isn't supplied, hrm should exit with a @@ -70,9 +68,17 @@ from optparse import OptionParser try: + # Python 2.6 and above import json except ImportError: - import simplejson as json + try: + # Python 2.4 and above + import simplejson as json + except ImportError: + print('Could not import json or simplejson. Please ' + 'either upgrade to Python 2.6 or above, or ' + 'run "sudo easy_install simplejson".') + sys.exit(-1) # Number of hours that must pass before we purge removed files. HOURS_TO_PURGE = 48