googleads/google-ads-python

NameError: name 'googleads_client' is not defined. Did you mean: 'GoogleAdsClient'?

JJordanCCurnow opened this issue · 1 comments

Describe the bug:
when trying to run:
https://github.com/googleads/google-ads-python/blob/main/examples/remarketing/upload_offline_conversion.py

NameError: name 'googleads_client' is not defined. Did you mean: 'GoogleAdsClient'?

Steps to Reproduce:
Download and run :
https://github.com/googleads/google-ads-python/blob/main/examples/remarketing/upload_offline_conversion.py
from master branch with any (0 included) number of args, will trigger the error as its in the arg parser.

Expected behavior:
Program starts.

Client library version and API version:
pip Freeze

aenum==3.1.15
aiofiles==24.1.0
aiohttp==3.9.3
aiosignal==1.3.1
annotated-types==0.6.0
anthropic==0.31.1
anyio==4.2.0
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asgiref==3.7.2
assemblyai==0.20.2
asttokens==2.4.1
async-lru==2.0.4
async-timeout==4.0.3
attrs==23.2.0
Babel==2.14.0
backcall==0.2.0
backoff==2.2.1
bcrypt==4.1.2
beautifulsoup4==4.12.3
bleach==6.1.0
boto3==1.34.34
botocore==1.34.34
build==1.0.3
cachetools==5.3.2
certifi==2024.2.2
cffi==1.16.0
charset-normalizer==3.3.2
click==8.1.7
coloredlogs==15.0.1
comm==0.2.1
contourpy==1.2.1
cryptography==42.0.2
cycler==0.12.1
dataclasses-json==0.6.4
DateTime==5.5
debugpy==1.8.0
decorator==5.1.1
deepgram-sdk==3.4.0
defusedxml==0.7.1
Deprecated==1.2.14
deprecation==2.1.0
distro==1.9.0
ecdsa==0.18.0
exceptiongroup==1.2.0
executing==2.0.1
fastapi==0.109.0
fastjsonschema==2.19.1
ffmpeg-python==0.2.0
filelock==3.13.1
flatbuffers==23.5.26
fonttools==4.53.1
fqdn==1.5.1
frozenlist==1.4.1
fsspec==2023.12.2
future==0.18.3
google-ads==24.1.0
google-ai-generativelanguage==0.6.6
google-api-core==2.19.1
google-api-python-client==2.137.0
google-auth==2.27.0
google-auth-httplib2==0.2.0
google-auth-oauthlib==0.8.0
google-generativeai==0.7.2
googleapis-common-protos==1.56.4
greenlet==3.0.3
groq==0.9.0
grpcio==1.64.1
grpcio-status==1.62.2
h11==0.14.0
httpcore==1.0.2
httplib2==0.22.0
httptools==0.6.1
httpx==0.26.0
huggingface-hub==0.20.3
humanfriendly==10.0
idna==3.6
importlib-metadata==6.11.0
importlib-resources==6.1.1
inflect==7.0.0
ipykernel==6.29.0
ipython==8.12.3
ipywidgets==8.1.1
isoduration==20.11.0
jedi==0.19.1
Jinja2==3.1.3
jiter==0.5.0
jmespath==1.0.1
joblib==1.3.2
json5==0.9.14
jsonpatch==1.33
jsonpointer==2.4
jsonschema==4.21.1
jsonschema-specifications==2023.12.1
jupyter==1.0.0
jupyter-console==6.6.3
jupyter-events==0.9.0
jupyter-lsp==2.2.2
jupyter_client==8.6.0
jupyter_core==5.7.1
jupyter_server==2.12.5
jupyter_server_terminals==0.5.2
jupyterlab==4.0.12
jupyterlab-widgets==3.0.9
jupyterlab_pygments==0.3.0
jupyterlab_server==2.25.2
kiwisolver==1.4.5
kubernetes==29.0.0
langchain==0.1.5
langchain-community==0.0.17
langchain-core==0.1.18
langsmith==0.0.86
Levenshtein==0.24.0
llvmlite==0.41.1
mangum==0.17.0
MarkupSafe==2.1.5
marshmallow==3.20.2
matplotlib==3.9.1
matplotlib-inline==0.1.6
mistune==3.0.2
mmh3==4.1.0
monotonic==1.6
mpmath==1.3.0
multidict==6.0.5
mypy-extensions==1.0.0
nbclient==0.9.0
nbconvert==7.14.2
nbformat==5.9.2
nest-asyncio==1.6.0
nltk==3.8.1
notebook==7.0.7
notebook_shim==0.2.3
numba==0.58.1
numpy==1.24.4
oauthlib==3.2.2
onnxruntime==1.16.3
openai==1.35.14
opentelemetry-api==1.22.0
opentelemetry-exporter-otlp-proto-common==1.22.0
opentelemetry-exporter-otlp-proto-grpc==1.22.0
opentelemetry-instrumentation==0.43b0
opentelemetry-instrumentation-asgi==0.43b0
opentelemetry-instrumentation-fastapi==0.43b0
opentelemetry-proto==1.22.0
opentelemetry-sdk==1.22.0
opentelemetry-semantic-conventions==0.43b0
opentelemetry-util-http==0.43b0
overrides==7.7.0
packaging==23.2
pandas==2.0.3
pandocfilters==1.5.1
parso==0.8.3
passlib==1.7.4
pexpect==4.9.0
pickleshare==0.7.5
pillow==10.4.0
platformdirs==4.2.0
posthog==3.3.4
prometheus-client==0.19.0
prompt-toolkit==3.0.43
proto-plus==1.24.0
protobuf==4.25.3
psutil==5.9.8
ptyprocess==0.7.0
pulsar-client==3.4.0
pure-eval==0.2.2
pyarrow==17.0.0
pyasn1==0.5.1
pyasn1-modules==0.3.0
pycparser==2.21
pydantic==2.6.0
pydantic_core==2.16.1
pydub==0.25.1
Pygments==2.17.2
pyparsing==3.1.2
PyPika==0.48.9
pyproject_hooks==1.0.0
python-dateutil==2.8.2
python-dotenv==1.0.1
python-jose==3.3.0
python-json-logger==2.0.7
python-Levenshtein==0.24.0
python-multipart==0.0.6
pytz==2024.1
PyYAML==6.0.1
pyzmq==25.1.2
qtconsole==5.5.1
QtPy==2.4.1
rapidfuzz==3.6.1
referencing==0.33.0
regex==2023.12.25
requests==2.31.0
requests-oauthlib==1.3.1
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rpds-py==0.17.1
rsa==4.9
s3transfer==0.10.0
safetensors==0.4.2
scipy==1.10.1
Send2Trash==1.8.2
six==1.16.0
sniffio==1.3.0
soupsieve==2.5
SQLAlchemy==2.0.25
stack-data==0.6.3
starlette==0.35.1
sympy==1.12
tenacity==8.2.3
terminado==0.18.0
tiktoken==0.5.2
tinycss2==1.2.1
tokenizers==0.15.1
tomli==2.0.1
tornado==6.4
tqdm==4.66.1
traitlets==5.14.1
transformers==4.37.2
typer==0.9.0
types-python-dateutil==2.8.19.20240106
typing-inspect==0.9.0
typing_extensions==4.9.0
tzdata==2023.4
uri-template==1.3.0
uritemplate==4.1.1
urllib3==1.26.19
uvicorn==0.27.0.post1
uvloop==0.19.0
watchfiles==0.21.0
wcwidth==0.2.13
webcolors==1.13
webencodings==0.5.1
websocket-client==1.7.0
websockets==12.0
widgetsnbextension==4.0.9
wrapt==1.16.0
yarl==1.9.4
zipp==3.17.0
zope.interface==6.4.post2

Request/Response Logs:

Traceback (most recent call last):
  File "/workspaces/upload_offline_conversion.py", line 223, in <module>
    choices=[e.name for e in googleads_client.enums.ConsentStatusEnum],
NameError: name 'googleads_client' is not defined. Did you mean: 'GoogleAdsClient'?

Anything else we should know about your project / environment:

  • Using VCS remote explorer, therefore running in a docker image ubuntu 22.04

@JJordanCCurnow thanks for pointing this out. Looks like googleads_client is accessed before it's initialized, so that's a bug we'll need to fix. I'll post a PR for it soon, meanwhile you can work around this by simply moving line 230 up to before the googleads_client variable is accessed.