Unknown option handling

svn: r1551
This commit is contained in:
Alex Roitman 2003-05-20 19:21:23 +00:00
parent fce16c6be4
commit 74181893a6

View File

@ -142,8 +142,14 @@ class Gramps:
self.cl = 1
if args:
options,leftargs = getopt.getopt(args,
const.shortopts,const.longopts)
try:
options,leftargs = getopt.getopt(args,
const.shortopts,const.longopts)
except getopt.GetoptError,msg:
print "Error: %s. Exiting." % msg
os._exit(1)
except:
print "Error parsing arguments: %s " % args
if leftargs:
print "Unrecognized option: %s" % leftargs[0]
os._exit(1)