From: Brett Parker Date: Thu, 9 Jul 2009 14:08:53 +0000 (+0100) Subject: Be slightly nicer when option parsing fails X-Git-Url: https://git.sommitrealweird.co.uk/curses-crossword.git/commitdiff_plain/95013783a7b2dcf4f9f2c9a13c2e7d1b0e319b59?hp=547335b843b32fb9a5c56d89b83bb73b63ea666e Be slightly nicer when option parsing fails --- diff --git a/curses-crossword.py b/curses-crossword.py index 92f9b92..19ee754 100644 --- a/curses-crossword.py +++ b/curses-crossword.py @@ -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":