From 0e38dfc65115a4a7c95e36acd4e4af28dcdaad3f Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Tue, 12 Feb 2013 10:19:34 +0100 Subject: [PATCH] more helpful messages when misusing sfi add --- sfa/client/sfi.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/sfa/client/sfi.py b/sfa/client/sfi.py index 8f9682f7..32036245 100644 --- a/sfa/client/sfi.py +++ b/sfa/client/sfi.py @@ -936,10 +936,17 @@ or version information about sfi itself if options.show_credential: show_credentials(auth_cred) record_dict = {} - if len(args) > 0: - record_filepath = args[0] - rec_file = self.get_record_file(record_filepath) - record_dict.update(load_record_from_file(rec_file).todict()) + if len(args) > 1: + self.print_help() + sys.exit(1) + if len(args)==1: + try: + record_filepath = args[0] + rec_file = self.get_record_file(record_filepath) + record_dict.update(load_record_from_file(rec_file).todict()) + except: + print "Cannot load record file %s"%record_filepath + sys.exit(1) if options: record_dict.update(load_record_from_opts(options).todict()) # we should have a type by now -- 2.43.0