Hello Jacob, You are using the wrong GroupEntry class, you should use gdata.contacts. data.GroupEntry<http://code.google.com/p/gdata-python-client/source/browse/src/gdata/contacts/data.py#433> instead of gdata.contacts.GroupEntry. The only imports from the GData client library that you would need should be:
import atom.data import gdata.data import gdata.contacts.client import gdata.contacts.data I hope this helps! Best, Alain On Sat, Jun 4, 2011 at 9:58 AM, Jacob <[email protected]> wrote: > Hello, > > This may, or may not, be a silly question, however, I have troubleshooted > on my own and browsed the web and support topics without success. I am just > creating a small client to manage my contacts (in Python) for fun and I can > create a new group. I get this error with traceback: > > Traceback (most recent call last): > File "contacts.py", line 121, in <module> > main() > File "contacts.py", line 117, in main > newGroup() > File "contacts.py", line 112, in newGroup > group_entry = client.CreateGroup(new_group) > File "/usr/local/lib/python2.7/dist-packages/gdata/contacts/client.py", > line 224, in create_group > desired_class=desired_class) > File "/usr/local/lib/python2.7/dist-packages/gdata/client.py", line 681, > in post > entry.to_string(get_xml_version(self.api_version)), > AttributeError: 'GroupEntry' object has no attribute 'to_string' > > I get this error when using this code: > > <beginning of code> > > import atom > import gdata.contacts.data > import gdata.contacts.client > > USER = 'username' > PASS = 'password' > SRC = 'Source Program' > > # Create a Contacts client object named 'client' > client = gdata.contacts.client.ContactsClient() > > def login(USER,PASS,SRC): > ''' This method will request an authentication key > from the Google Server and will store that key > into a variable in case we need it again for > verification purposes later. > ''' > > # Request authentication using the ContactsClient > # ClientLogin() method, passing the variables that > # contain the user's email, password, and the > # source of the program. > global client > client.ClientLogin(USER,PASS,SRC) > > # Store the auth token in a variable 'token'. This > # might be more useful if you were storing them > # into a database for future reference.. > token = client.auth_token.token_string > > def newGroup(): > new_group = gdata.contacts.GroupEntry(title=atom.data.Title(text='my best > friends')) > group_entry = client.CreateGroup(new_group) > > def main(): > login(USER,PASS,SRC) > newGroup() > > > if __name__ == '__main__': > main() > > <end of code> > > I am not sure if I'm doing something wrong when trying to create the group. > It seems like I am missing some necessary import. At first glance though, it > seems like its not finding the atom import's ToString method or something. > Any ideas/help? > > Thanks! > Jacob > > -- > You received this message because you are subscribed to the Google > Groups "Google Contacts, Shared Contacts and User Profiles APIs" group. > To post to this group, send email to > [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://code.google.com/apis/contacts/community/forum.html > -- Alain Vongsouvanh -- You received this message because you are subscribed to the Google Groups "Google Contacts, Shared Contacts and User Profiles APIs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://code.google.com/apis/contacts/community/forum.html
