Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install adwords Api for python - 'Given yaml file, %s, could not be opened.' % path)'

I try install the adwords api for python following the steps of this reference guide : https://github.com/googleads/googleads-python-lib/wiki/API-access-using-own-credentials-(installed-application-flow)#step-2---setting-up-the-client-library

Everything is okay, but in the last step(6), I have one problem.

I try run the code:

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

And Error is:

> >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.

My googleads.yaml is:

  adwords:
  client_id: xxxxxxx
  client_secret: xxxxxx
  refresh_token: xxxxxx

Where xxxx is my passwords keys

I can't understand what problem in my install process.

like image 431
FlávioCorinthians Avatar asked May 31 '26 17:05

FlávioCorinthians


1 Answers

Had faced similar problem. By default it searchs for the googleads.yaml file in the home directory, you can point it to your location while creating your AdWords client, e.g.,

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

eg:

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

Hope this solves it.

like image 131
tabu 18 Avatar answered Jun 03 '26 06:06

tabu 18



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!