googleads-python-lib icon indicating copy to clipboard operation
googleads-python-lib copied to clipboard

Examples not working and suds resolver errors

Open smartermarketing opened this issue 12 years ago • 7 comments

This is a reopening of #35 so refer to that issue for details

Running this on Ubuntu 12.04

@msaniscalchi I've set this up in a new virtualenv with only googleads + dependencies installed and the problem persists. You should be able to reproduce the error like this:

virtualenv gads;cd gads;source ./bin/activate
pip install googleads
wget https://github.com/googleads/googleads-python-lib/archive/master.zip
unzip master.zip
python googleads-python-lib-master/examples/adwords/v201409/optimization/estimate_keyword_traffic.py 

...

No handlers could be found for logger "suds.resolver"
Traceback (most recent call last):
  File "googleads-python-lib-master/examples/adwords/v201409/optimization/estimate_keyword_traffic.py", line 122, in <module>
main(adwords_client)
  File "googleads-python-lib-master/examples/adwords/v201409/optimization/estimate_keyword_traffic.py", line 101, in main
mean_avg_cpc = (long(estimate['min']['averageCpc']['microAmount']) +
  File "/home/vagrant/gads/local/lib/python2.7/site-packages/suds/sudsobject.py", line 154, in __getitem__
    return getattr(self, name)
AttributeError: 'StatsEstimate' object has no attribute 'averageCpc'

For good measure, here's the result when you add a logger for suds as well: https://www.dropbox.com/s/oib6a6arg8ian1j/Screenshot%202014-11-14%2020.40.36.png?dl=0

smartermarketing avatar Nov 14 '14 12:11 smartermarketing

I've not been able to reproduce on a fresh Debian 7.2 VM or a non-fresh Ubuntu 12.04 machine. I'll see if I can try this out on a fresh Ubuntu 12.04 VM next.

Out of curiosity, have you tried doing anything else with the affected VM? I'd be very interested in knowing if this affects more than just this example.

msaniscalchi avatar Nov 14 '14 20:11 msaniscalchi

Also not reproducible on a fresh 12.04 VM. Odd.

One thing that comes to mind is that maybe you somehow installed a different version of suds. What version are you using?

msaniscalchi avatar Nov 14 '14 20:11 msaniscalchi

I can reproduce this issue as well. Tried 3 different versions of suds-jurko: 0.5, 0.6, 0.7 (dev. version) and i got the same result with all of them.

I'm using Ubuntu 14.04 VM (vagrant ubuntu/trusty64)

parander avatar Nov 17 '14 09:11 parander

I believe I've discovered the cause. The StatsEstimate won't include the averageCpc, averagePosition and clickThroughRate fields if clicksPerDay or impressionsPerDay are 0 as of v201406. It seems this sample wasn't adequately updated to handle the change, and it couldn't be reproduced earlier because the test account always provided a clicksPerDay and impressionsPerDay > 0.

Thanks for reporting! I'll add a fix for this in the next release and close this once available.

msaniscalchi avatar Nov 19 '14 17:11 msaniscalchi

@msaniscalchi Cool, please note that there is an additional error in the screenshot provided. And that @parander also gets that error.

schmilblick avatar Nov 24 '14 07:11 schmilblick

Yes besides the averageCpc missing the logger reports plenty of these, which i assume is unrelated to the averageCpc thing:

suds.resolver [resolver.py:134] [ERROR] [root] (Money) not-found suds.resolver [resolver.py:116] [ERROR] [find] path: "Money", not-found suds.resolver [resolver.py:134] [ERROR] [root] (Keyword) not-found suds.resolver [resolver.py:116] [ERROR] [find] path: "Keyword", not-found ....... repeated many times.... suds.resolver [resolver.py:134] [ERROR] [root] (Keyword) not-found suds.resolver [resolver.py:116] [ERROR] [find] path: "Keyword", not-found

parander avatar Nov 25 '14 10:11 parander

suds.resolver [resolver.py:134] [ERROR] root not-found suds.resolver [resolver.py:116] [ERROR] [find] path: "Money", not-found suds.resolver [resolver.py:134] [ERROR] root not-found suds.resolver [resolver.py:116] [ERROR] [find] path: "Keyword", not-found ... This still occurs (as of 2.3.0).

Add: import logging logging.basicConfig()

To the example to reproduce.

parander avatar Dec 15 '14 09:12 parander