def __call__(self, parser, namespace, values, option_string=None):
file_location = values if values else self.default
config = ConfigParser.ConfigParser()
try:
with open(file_location) as fp:
config.readfp(fp)
except (IOError, ConfigParser.Error) as e:
raise argparse.ArgumentError(self, "Unable to read URL file: {}".format(e))
setattr(namespace, self.dest, config)
评论列表
文章目录