KeyError: 'proto3_optional'

521 views
Skip to first unread message

qi li

unread,
Aug 6, 2021, 4:58:33 AM8/6/21
to AdWords API and Google Ads API Forum
Traceback (most recent call last):
  File "/usr/local/python3/lib/python3.8/site-packages/google/protobuf/internal/python_message.py", line 545, in _GetFieldByName
    return message_descriptor.fields_by_name[field_name]
KeyError: 'proto3_optional'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "google_cost.py", line 47, in <module>
    cost_sg1=main(googleads_client, "2810333029",data_date)
  File "google_cost.py", line 11, in main
    ga_service = client.get_service("GoogleAdsService")
  File "/usr/local/python3/lib/python3.8/site-packages/google/ads/googleads/client.py", line 358, in get_service
    service_client_class = getattr(
  File "/usr/local/python3/lib/python3.8/site-packages/google/ads/googleads/v8/__init__.py", line 1696, in __getattr__
    module = importlib.import_module(f"{_lazy_type_to_package_map[name]}")
  File "/usr/local/python3/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/local/python3/lib/python3.8/site-packages/google/ads/googleads/v8/services/services/google_ads_service/__init__.py", line 16, in <module>
    from .client import GoogleAdsServiceClient
  File "/usr/local/python3/lib/python3.8/site-packages/google/ads/googleads/v8/services/services/google_ads_service/client.py", line 32, in <module>
    from google.ads.googleads.v8.services.services.google_ads_service import pagers
  File "/usr/local/python3/lib/python3.8/site-packages/google/ads/googleads/v8/services/services/google_ads_service/pagers.py", line 18, in <module>
    from google.ads.googleads.v8.services.types import google_ads_service
  File "/usr/local/python3/lib/python3.8/site-packages/google/ads/googleads/v8/services/types/google_ads_service.py", line 18, in <module>
    from google.ads.googleads.v8.common.types import metrics as gagc_metrics
  File "/usr/local/python3/lib/python3.8/site-packages/google/ads/googleads/v8/common/types/metrics.py", line 29, in <module>
    class Metrics(proto.Message):
  File "/usr/local/python3/lib/python3.8/site-packages/proto/message.py", line 176, in __new__
    field.descriptor.oneof_index = oneofs[field.oneof] = len(oneofs)
  File "/usr/local/python3/lib/python3.8/site-packages/proto/fields.py", line 104, in descriptor
    self._descriptor = descriptor_pb2.FieldDescriptorProto(
  File "/usr/local/python3/lib/python3.8/site-packages/google/protobuf/internal/python_message.py", line 484, in init
    field = _GetFieldByName(message_descriptor, field_name)
  File "/usr/local/python3/lib/python3.8/site-packages/google/protobuf/internal/python_message.py", line 547, in _GetFieldByName
    raise ValueError('Protocol message %s has no "%s" field.' %
ValueError: Protocol message FieldDescriptorProto has no "proto3_optional" field.


description:when i run the program in my mac,it is ok.but when i run it in linux ,it has an error.I am going to obtain the cost of account.so what is the reason?

Google Ads API Forum Advisor

unread,
Aug 9, 2021, 11:00:05 AM8/9/21
to liqiti...@gmail.com, adwor...@googlegroups.com
Hi Qi,

To get help for an issue with the Python Client Library you can post on the Ads API Python Client Library issue tracker.

Regards,

Google Logo
Aryeh Baker
Google Ads API Team
 


ref:_00D1U1174p._5004Q2Ll4SX:ref
Reply all
Reply to author
Forward
0 new messages