CORRECTIONS - I had some typos - please refer to this post as opposed to the 
one before this.
-------
I'm using the python client library v14.0.0.0 and having trouble getting a 
simple sandbox script to work because it can't seem to find the zsi module, 
which is weird! Have included the folder structure, traceback, and script 
below.

I've noticed that different parts in the adspygoogle api include imports and 
matches on "zsi" and "ZSI", but I thought python was case-insensitive? When 
I change the name of the adspygoogle/common/ZSI to adspygoogle/common/zsi, I 
get a different traceback error...

Or is there something wrong with how I've defined my sys.path.append? Anyone 
run into this before?

Users -->
     khuang --->
           Projects -->
                  adwords_api_python_14.0.0 -->
                         get_all_campaigns.py
                         adspygoogle -->
                               adwords -->
                               common -->

---------------------------------------------
Command line...
python get_all_campaigns.py
Traceback (most recent call last):
  File "get_all_campaigns.py", line 52, in <module>
    'https://adwords-sandbox.google.com', 'v201101')
  File 
"/Users/khuang/Projects/adwords_api_python_14.0.0/adspygoogle/adwords/AdWordsClient.py",
 
line 848, in GetCampaignService
    self.__logger)
  File 
"/Users/khuang/Projects/adwords_api_python_14.0.0/adspygoogle/adwords/CampaignService.py",
 
line 57, in __init__
    headers, config, op_config, url, 'adspygoogle.adwords', lock, logger)
  File 
"/Users/khuang/Projects/adwords_api_python_14.0.0/adspygoogle/common/ApiService.py",
 
line 57, in __init__
    exec 'from %s.zsi import SanityCheck as ToolkitSanityCheck' % 
import_chain
  File "<string>", line 1, in <module>
ImportError: No module named zsi

------------------------------------
# get_all_campaigns.py
import os
import sys

# KH: Specify path to "adspygoogle" module
sys.path.append(os.path.join('/Users', 'khuang', 'Projects', 
'adwords_api_python_14.0.0'))

# Import appropriate classes from the client library.
from adspygoogle.adwords.AdWordsClient import AdWordsClient

headers = {
  'email': '########@gmail.com',
  'password': '##########',
  'authToken': '...',
  'clientEmail': 'client_1+########@gmail.com',
  'clientCustomerId': '1234567890',
  'userAgent': 'GoogleTest',
  'developerToken': '#########@gmail.com++USD',
  'validateOnly': 'n',
  'partialFailure': 'n'
}

# Initialize client object.
client = AdWordsClient(headers=headers, 
path=os.path.join('/Users', 'khuang', 'Projects', 
'adwords_api_python_14.0.0'))

# Initialize appropriate service.
campaign_service = client.GetCampaignService(
    'https://adwords-sandbox.google.com', 'v201101')

# Construct selector and get all campaigns.
selector = {
    'fields': ['Id', 'Name', 'Status']
}
campaigns = campaign_service.Get(selector)[0]

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en

Reply via email to