Impossible to execute 'from googleads import adwords'
This should be extremely easy but I've struggling a couple of hours and I cannot get through it. I'm trying to import the module 'adwords' with this code:
import datetime import urllib.parse import uuid from googleads import adwords
I keep getting this error:
(my_env) C:\Users\Trabajo\test>python adwords_test.py
Traceback (most recent call last): File "C:\Users\Trabajo\test\adwords_test.py", line 5, in from googleads import adwords ImportError: cannot import name 'adwords' from 'googleads' (C:\Users\Trabajo\anaconda3\envs\my_env\lib\site-packages\googleads_init_.py)
I have this modules installed (can provide full list if needed):
google-ads==21.1.0 google-api-core==2.11.0 google-auth==2.17.3 google-auth-oauthlib==0.8.0 googleads==37.0.0 googleapis-common-protos==1.59.0 [...]
I tried different ways to import the module, based on a chatGPT response:
from googleads import adwords from google.ads.google_ads import adwords
neither worked 😔
I also tried to uninstall and install again both googleads and google_ads modules, as I'm pretty sure it has something to do with googleads version.
Thank you!
The Google Ads API is an enterprise grade, very popular API. It is updated extremely frequently.
ChatGPT only knows about things that existed before 2021. In Ads API terms, this is ancient. The version released in 2021 has already been deprecated.
For a start, all references to AdWords have long gone. Second of all, you really are doing yourself a disservice by using ChatGPT for this task. The documentation and examples are far better than what GPT can give you.
Here's some examples: https://github.com/googleads/google-ads-python/tree/main/examples
Over the past year, the developers have done an amazing job at abstracting away almost all of what you were trying to do. I think if you just go through the quick start, you'll appreciate it a lot more.
If you want to explain exactly what you're trying to do after that, I'd love to provide further guidance.
Thank you Dave! I managed to get my script working with the examples 👍