On May 11, 12:30 pm, Nick Craig-Wood <n...@craig-wood.com> wrote: > def __init__(self): > usage = '''Usage: %prog [options] YYMMDD > %prog -h|--help > ''' > parser = OptionParser(usage=usage) > parser.add_option("-n", "--no-newline", dest="nonl", > action="store_true", help="omit newline in output") > (options, args) = parser.parse_args(); > try: > weekday = self.wkday_abbrev(args[0]) > except BadDateString, e: > print usage > print e > sys.exit(1)
I would recommend printing error messages to sys.stderr. BTW, in this particular case you may want to use parser.error(e) instead of print + sys.exit. -- Marius Gedminas -- http://mail.python.org/mailman/listinfo/python-list