Unknown option handling

svn: r1551
This commit is contained in:
Alex Roitman 2003-05-20 19:21:23 +00:00
parent 0946e3c0f7
commit 7eded566a4

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)