Mercurial > hrm
changeset 21:7fa60aca382d
More helpful error message if json, simplejson can't be found.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Thu, 11 Dec 2008 07:52:26 -0800 |
parents | c14445b5eee0 |
children | dafc1cce8a2c |
files | hrm.py |
diffstat | 1 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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