]> git.sommitrealweird.co.uk Git - curses-crossword.git/commitdiff
Be slightly nicer when option parsing fails
authorBrett Parker <iDunno@sommitrealweird.co.uk>
Thu, 9 Jul 2009 14:08:53 +0000 (15:08 +0100)
committerBrett Parker <iDunno@sommitrealweird.co.uk>
Thu, 9 Jul 2009 14:08:53 +0000 (15:08 +0100)
curses-crossword.py

index 92f9b926394fa9ee8df623d348cd0715c4c2ff10..19ee754ef125f87a3bcf9692701ce1fd6dbd1c2e 100644 (file)
@@ -32,7 +32,11 @@ except:
 
 filename = None
 
-(options, args) = getopt.getopt(sys.argv[1:], "f:", "file=")
+try:
+    (options, args) = getopt.getopt(sys.argv[1:], "f:", "file=")
+except getopt.GetoptError, err:
+    print str(err)
+    sys.exit(2)
 
 for option in options:
     if option[0] == "-f" or option[0] == "--file":