我正在尝试让 Google AdManager API 用于 Colab 笔记本。
按照此处的说明,我设法创建了自己的配置 YAML 文件,将其上传到 Colab 笔记本并执行对NetworkService
服务的基本调用。一切顺利并按预期运行,返回预期的网络名称和 ID。
然后我尝试添加更多这样的请求,我收到以下错误消息:
FileNotFoundError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/googleads/common.py in LoadFromStorage(path, product_yaml_key, required_client_values, optional_product_values)
279 try:
--> 280 with open(path, 'rb') as handle:
281 yaml_doc = handle.read()
FileNotFoundError: [Errno 2] No such file or directory: '/root/googleads.yaml',
During handling of the above exception, another exception occurred:
GoogleAdsValueError Traceback (most recent call last)
<ipython-input-14-ed9b34dcaa81> in <module>()
25 if __name__ == '__main__':
26 # Initialize client object.
---> 27 ad_manager_client = ad_manager.AdManagerClient.LoadFromStorage()
28 main(ad_manager_client)
/usr/local/lib/python3.6/dist-packages/googleads/ad_manager.py in LoadFromStorage(cls, path)
202 return cls(**googleads.common.LoadFromStorage(
203 path, cls._YAML_KEY, cls._REQUIRED_INIT_VALUES,
--> 204 cls._OPTIONAL_INIT_VALUES))
205
206 def __init__(self, oauth2_client, application_name, network_code=None,
/usr/local/lib/python3.6/dist-packages/googleads/common.py in LoadFromStorage(path, product_yaml_key, required_client_values, optional_product_values)
282 except IOError:
283 raise googleads.errors.GoogleAdsValueError(
--> 284 'Given yaml file, %s, could not be opened.' % path)
285
286 try:
GoogleAdsValueError: Given yaml file, /root/googleads.yaml, could not be opened.
尽管事实上上传到 notebook ( content/googleads.yaml
) 文件夹中的相同 yaml 文件在第一个请求中运行良好。
任何帮助表示赞赏。
谢谢!
PS:只是为了让你知道,我对 Python 还处于起步阶段。