我看不到任何多余的空格或不必要的缩进。这是令人沮丧的。有人可以告诉我我在做什么错:
def main():
""" This is a simple EC2 Command line tool"""
@click.group()
@click.option('--ami', default='ami-0de7daa7385332688', help='What AWS AMI are you using?')
@click.option('--instancetype', default='t2.micro', help='AWS EC2 instance type')
@click.option('--vpc', help='VPC ID')
@click.option('--isweb',default=True,help='Is this a web server')
if __name__ == "__main__":
main()
答案 0 :(得分:2)
装饰器是在类/方法/函数定义之前指定的,请参见documentation。
所以在您的情况下:
@click.group()
@click.option('--ami', default='ami-0de7daa7385332688', help='What AWS AMI are you using?')
@click.option('--instancetype', default='t2.micro', help='AWS EC2 instance type')
@click.option('--vpc', help='VPC ID')
@click.option('--isweb',default=True,help='Is this a web server')
def main():
""" This is a simple EC2 Command line tool"""
pass
if __name__ == "__main__":
main()