From: W. Trevor King Date: Fri, 18 Jan 2013 21:46:23 +0000 (-0500) Subject: main: Catch command-less case for Python 3.3 X-Git-Tag: v3.0~20 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a3a17a27e5b556562fff37ab1c9f78347e61c1a4;p=rss2email.git main: Catch command-less case for Python 3.3 In Python 3.2, the argument parser raises an error if no subcommand is listed on the command line. This does not seem to be the case with Python 3.3.0, and the changed behavior seems to have been a side effect of this: http://hg.python.org/cpython/rev/cab204a79e09 changeset: 70741:cab204a79e09 user: R David Murray date: Thu Jun 09 12:34:07 2011 -0400 summary: #10424: argument names are now included in the missing argument mes Anyhow, it's easy enough to catch the new behaviour in rss2email and print the appropriate error. Reported-by: Dmitry Bogatov Signed-off-by: W. Trevor King --- diff --git a/rss2email/main.py b/rss2email/main.py index 8a4fb9e..74ccd30 100644 --- a/rss2email/main.py +++ b/rss2email/main.py @@ -150,6 +150,9 @@ def run(*args, **kwargs): if args.verbose: _LOG.setLevel(max(_logging.DEBUG, _logging.ERROR - 10 * args.verbose)) + if not getattr(args, 'func', None): + parser.error('too few arguments') + try: if not args.config: args.config = None