Encoding error with google adwords api

I am using google adwords api. Currenlty is my only code:

from googleads import adwords
adwords_client = adwords.AdWordsClient.LoadFromStorage()

      

As a result, an error message is displayed Your default encoding, cp1252, is not UTF-8. Please run this script with UTF-8 encoding to avoid errors.

I am using Python 3.6 which should be UTF-8 by default. What is the source of this error / how to avoid it?

+3


source to share


1 answer


It turns out this is actually a warning coming from googleads

when the default encoding returned locale.getdefaultlocale()

is not UTF-8.

If your script works without issue, then I feel like you can safely ignore it. Otherwise, it might be worth trying to set a different language at the beginning of your code:



import locale
locale.setlocale(locale.LC_ALL, NEW_LOCALE)

      

I understand that you are using Windows, so I am not sure what the correct language definitions are. On Linux, you can use en_US.UTF-8

, but it probably won't work for you.

+2


source







All Articles