From: Thierry Parmentelat Date: Tue, 12 Feb 2013 09:19:34 +0000 (+0100) Subject: more helpful messages when misusing sfi add X-Git-Tag: sfa-2.1-25~8^2 X-Git-Url: http://git.onelab.eu/?p=sfa.git;a=commitdiff_plain;h=0e38dfc65115a4a7c95e36acd4e4af28dcdaad3f more helpful messages when misusing sfi add --- 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