脚本不接受参数

时间:2020-08-14 11:45:50

标签: python-3.x google-ads-api

我正在使用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。

0 个答案:

没有答案