Encoding error using google adwords api

Viewed 4534

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

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

This results in an error displaying 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 is it avoided?

2 Answers

Try importing the _locale module.

import _locale

_locale._getdefaultlocale = (lambda *args: ['en_US', 'UTF-8'])

Related