From a38a7d0293dd6245d31d7ea34f0cab240e969797 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sat, 11 Mar 2017 05:39:30 +0100 Subject: [PATCH] fix borg key/debug/benchmark crashing without subcommand, fixes #2240 --- src/borg/archiver.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/borg/archiver.py b/src/borg/archiver.py index cb4350a1d..931933bc2 100644 --- a/src/borg/archiver.py +++ b/src/borg/archiver.py @@ -3334,10 +3334,11 @@ class Archiver: args = self.preprocess_args(args) parser = self.build_parser() args = parser.parse_args(args or ['-h']) - if args.func == self.do_create: + # This works around http://bugs.python.org/issue9351 + func = getattr(args, 'func', None) or getattr(args, 'fallback_func') + if func == self.do_create and not args.paths: # need at least 1 path but args.paths may also be populated from patterns - if not args.paths: - parser.error('Need at least one PATH argument.') + parser.error('Need at least one PATH argument.') return args def prerun_checks(self, logger):