main 方法上的意外缩进
Unexpected indent on main method
我看不到任何地方有多余的空格或不必要的缩进。这太令人沮丧了。有人可以告诉我我做错了什么吗:
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()
装饰器在 class/method/function 定义之前指定,参见 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()
我看不到任何地方有多余的空格或不必要的缩进。这太令人沮丧了。有人可以告诉我我做错了什么吗:
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()
装饰器在 class/method/function 定义之前指定,参见 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()