gpt4 book ai didi

python-2.7 - 为 python 安装 adwords Api - 'Given yaml file, %s, could not be opened.' % 路径)'

转载 作者:行者123 更新时间:2023-12-02 06:30:37 25 4
gpt4 key购买 nike

我尝试按照本引用指南的步骤为 python 安装 adwords api:https://github.com/googleads/googleads-python-lib/wiki/API-access-using-own-credentials-(installed-application-flow)#step-2---setting-up-the-client-library

一切都很好,但在最后一步(6)中,我遇到了一个问题。

我尝试运行代码:

from googleads import adwords
# Initialize the AdWords client.
adwords_client = adwords.AdWordsClient.LoadFromStorage()

错误是:

> >pythonw -u "teste_adwords_api.py" Traceback (most recent call last):   File "teste_adwords_api.py", line 3, in <module>
> adwords_client = adwords.AdWordsClient.LoadFromStorage() File "C:\Users\Flávio\Google Drive\BI Caiçara\Python\googleads\adwords.py",
> line 243, in LoadFromStorage
> cls._OPTIONAL_INIT_VALUES)) File "C:\Users\Flávio\Google Drive\BI Caiçara\Python\googleads\common.py", line 128, in
> LoadFromStorage
> 'Given yaml file, %s, could not be opened.' % path) googleads.errors.GoogleAdsValueError: Given yaml file,
> C:\Users\Flávio\googleads.yaml, could not be opened.

我的 googleads.yaml 是:

  adwords:
client_id: xxxxxxx
client_secret: xxxxxx
refresh_token: xxxxxx

xxxx 是我的密码 key

我不明白我的安装过程中有什么问题。

最佳答案

遇到过类似的问题。默认情况下,它会在主目录中搜索 googleads.yaml 文件,您可以在创建 AdWords 客户端时将其指向您的位置,例如,

adwords_client = AdWordsClient.LoadFromStorage("full_path_to_your_googleads.yaml")

例如:

adwords_client=AdWordsClient.LoadFromStorage(""C:\\MacUSer\\Documents\\googleads.yaml")

希望这能解决问题。

关于python-2.7 - 为 python 安装 adwords Api - 'Given yaml file, %s, could not be opened.' % 路径)',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38620634/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com