脚本不接受参数

问题描述

我正在使用Google Ads API中的代码构建脚本。在此脚本中,我尝试创建一个新帐户,要实现此目的,我需要选择该脚本应位于哪个经理帐户下。这是通过以下代码完成的:

parser = argparse.ArgumentParser(description=('Creates a new client under the given manager.'))
# The following argument(s) should be provided to run the example.
parser.add_argument('-m','--manager_customer_id',type=str,required=True,help='A Google Ads customer ID for the '
                    'manager account under which the new customer will '
                    'be created.')
args = parser.parse_args()

因此,当我运行脚本时,我输入python new_acc.py xxx-xxx-xxxx并按Enter键,然后出现以下错误

usage: new_acc.py [-h] -m MANAGER_CUSTOMER_ID
new_acc.py: error: the following arguments are required: -m/--manager_customer_id

我还试图在.yaml文件添加manager_customer_id。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)