I am trying to delete a document using the Python API, and I get the
following error when I pass the EditLink for the document to the
Delete function:

Deleting document at  
http://docs.google.com/feeds/documents/private/full/spreadsheet%3ApjIZM9HKak4nWP-DPux-mZQ/fnekxoja
Traceback (most recent call last):
  File "docs_example.py", line 290, in <module>
    main()
  File "docs_example.py", line 286, in main
    sample.Run()
  File "docs_example.py", line 244, in Run
    self._DeleteMenu()
  File "docs_example.py", line 166, in _DeleteMenu
    success =
self.gd_client.Delete(self,feed.entry[int(file_to_delete)].GetEditLink().href)
  File "C:\Python25\Lib\site-packages\gdata\service.py", line 1059, in
Delete
    headers=extra_headers)
  File "C:\Python25\Lib\site-packages\atom\service.py", line 161, in
request
    all_headers.update(headers)
ValueError: dictionary update sequence element #0 has length 1; 2 is
required

Here is the code the causes the error (I added this function to the
docs_example.py script in the examples folder):

  def _DeleteMenu(self):
    """Retrieves a list of all of a user's documents and displays
them."""
    feed = self.gd_client.GetDocumentListFeed()
    self._PrintFeed(feed)

    file_to_delete = ''
    file_to_delete = raw_input('Enter file id to delete: ')

    if not file_to_delete:
      return

    print 'Deleting document at ',
feed.entry[int(file_to_delete)].GetEditLink().href
    success =
self.gd_client.Delete(self,feed.entry[int(file_to_delete)].GetEditLink().href)

    if not success:
      print 'File was not successfully deleted'
    else:
      print 'Delete was successful '



Does anyone have any ideas as to why this wouldn't work? Thanks for
the help,

Dave
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Docs Data 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://groups.google.com/group/Google-Docs-Data-APIs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to