Get the account hierarchy under the current account thanks ManagerCustomerService, "Service __len__ not found"

102 views
Skip to first unread message

Vivien Morlet

unread,
Feb 6, 2020, 8:35:57 AM2/6/20
to AdWords API and Google Ads API Forum
Hello,

I am trying to get all the accounts under a GoogleAds manager account thanks to the code samples you can find here:
https://developers.google.com/adwords/api/docs/samples/python/account-management#get-the-account-hierarchy-under-the-current-account

Unfortunately, the given sample doesn't work for me, and when I run the command: 
managed_customer_service = adwords_client.GetService('ManagedCustomerService',
version='v201809')
I receive the following error message: 
googleads.errors.GoogleAdsValueError: Service __len__ not found
Unexpected error, recovered safely.

The client is well initialized, what did I wrong?

Thanks for your help.

M.Morlet

Google Ads API Forum Advisor Prod

unread,
Feb 6, 2020, 3:05:39 PM2/6/20
to morlet...@gmail.com, adwor...@googlegroups.com
Hi Vivien,

Thank you for reaching out. Can you please provide the complete detailed request and response logs via Reply privately to author so that I can further investigate this issue? You can find information on enabling logging here.

Regards,
Mitchell
Google Ads API Team

ref:_00D1U1174p._5001UV05gv:ref

Michael Grablevskii

unread,
Feb 10, 2020, 10:24:32 AM2/10/20
to AdWords API and Google Ads API Forum
I seem to have the same problem.

python3.8

My code: 

from googleads import adwords

def execute_request():
    adwords_client
= adwords.AdWordsClient.LoadFromStorage(path="google_general/googleads.yaml")
    campaign_service
= adwords_client.GetService('CampaignService', version='v201809')
   
pass


context
["dict_list"] = execute_request()

 Traceback:

Traceback (most recent call last):
 
File "/home/michael/pycharm-community-2019.3.2/plugins/python-ce/helpers/pydev/_pydevd_bundle/pydevd_xml.py", line 282, in frame_vars_to_xml
    xml
+= var_to_xml(v, str(k), evaluate_full_value=eval_full_val)
 
File "/home/michael/pycharm-community-2019.3.2/plugins/python-ce/helpers/pydev/_pydevd_bundle/pydevd_xml.py", line 369, in var_to_xml
   
elif hasattr(v, "__len__") and not is_string(v):
 
File "/home/michael/PycharmProjects/ads3/venv/lib/python3.8/site-packages/googleads/common.py", line 694, in __getattr__
   
raise googleads.errors.GoogleAdsValueError('Service %s not found' % attr)

googleads
.errors.GoogleAdsValueError: Service __len__ not found
Unexpected error, recovered safely.

googleads.yaml about logging

logging:
  version
: 1
  disable_existing_loggers
: False
  formatters
:
    default_fmt
:
      format
: ext://googleads.util.LOGGER_FORMAT
    handlers
:
      default_handler
:
       
class: logging.StreamHandler
        formatter
: default_fmt
        level
: DEBUG
    loggers
:
   
# Configure root logger
     
"":
      handlers
: [default_handler]
      level
: DEBUG

I've just started studying the API. Namely, I'm trying to execute my first request (https://developers.google.com/adwords/api/docs/guides/first-api-call#make_your_first_api_call)


Could you help me with this problem? At least how to localize it more precisely.



Google Ads API Forum Advisor Prod

unread,
Feb 10, 2020, 3:29:45 PM2/10/20
to poisk...@gmail.com, adwor...@googlegroups.com
Hi Michael,

Thank you for reaching out. Vivien determined that this was a Pycharm issue so I would recommend reaching out to their support. Let me know if they are unable to assist you.

Michael Grablevskii

unread,
Feb 13, 2020, 9:03:36 AM2/13/20
to AdWords API and Google Ads API Forum

Google Ads API Forum Advisor Prod

unread,
Feb 13, 2020, 10:46:01 AM2/13/20
to poisk...@gmail.com, adwor...@googlegroups.com
Hi Michael,

Vivien was able to get her program to work when she ran it in "Run" mode as opposed to "Debug" mode so hopefully that works for you as well. Please make sure you inform PyCharm support of the issue so that they can help provide a solution.

Michael Grablevskii

unread,
Feb 13, 2020, 1:12:12 PM2/13/20
to AdWords API and Google Ads API Forum
Vivien was able to get her program to work when she ran it in "Run" mode as opposed to "Debug" mode so hopefully that works for you as well. Please make sure you inform PyCharm support of the issue so that they can help provide a solution.
 
IDE is necessary mainly for debugging. If PyCharm can't debug, then it is useless. I informed their support. No reaction so far. I'm not sure that they will fix this bag.
Reply all
Reply to author
Forward
0 new messages