From 45ef024c200ed861216a6f174f42ad48bd3bde5b Mon Sep 17 00:00:00 2001 From: Joel Schaerer Date: Sat, 14 Feb 2009 10:28:27 +0100 Subject: [PATCH] Better error handling. Thanks Lionel Ott! --- autojump | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/autojump b/autojump index b092a76..ec434dd 100755 --- a/autojump +++ b/autojump @@ -4,7 +4,7 @@ from __future__ import division import cPickle import getopt -from sys import argv +from sys import argv,exit import os import signal @@ -39,7 +39,12 @@ def match(path,pattern,path_dict,re_flags=0): del path_dict[path] return False -optlist, args = getopt.getopt(argv[1:], 'a',['stat','import','completion']) +try: + optlist, args = getopt.getopt(argv[1:], 'a',['stat','import','completion']) +except getopt.GetoptError, e: + print "Unknown command line argument: %s" % e + exit(1) + dic_file=os.path.expanduser("~/.autojump_py") try: aj_file=open(dic_file)