Thursday, February 2, 2012

GoogleCL Docs Upload Fixed for Gdata 2.0.15 and 2.0.16

Months ago, we fixed Google Docs Uploads for GoogleCL folks who use python-gdata 2.0.12 through 2.0.14. Today, we tackled the problem for users of python-gdata 2.0.15 and 2.0.16.

A user sent in a patch that fixed the MIMETYPES error we were getting with 2.0.15 and 2.0.16. It looks like python-gdata moved away from declaring MIMETYPES where we were calling them from, so now we name them explicitly in googlecl/src/googlecl/docs/client.py.

That was a great start, but then we started getting a DocsEntry error and uploads still wouldn't work, so we delved further. Here's the error we got after fixing the MIMETYPES problem.
AttributeError: 'module' object has no attribute 'DocsEntry'

One of our earlier searches brought us to the same error posted on python-gdata's buglist.

Then, we found this blog post, by Demon Lord, where they had success replacing the string "gdata.docs.data.DocsEntry" with the string "gdata.data.GDEntry". We tried that throughout the file googlecl/src/googlecl/docs/client.py and sure enough, that fixed it!

We tested 2.0.0 through 2.0.4 to make sure that didn't break anything for those users and then tested 2.0.12 through 2.0.16 to make sure it worked on all the versions that should be able to upload docs. It does so it's now been committed.

1 comment:

  1. Actually, the fix still isn't working:

    mandriver@mandriver-laptop:/tmp/googlecl-read-only$ /usr/local/bin/google docs list
    Traceback (most recent call last):
    File "/usr/local/bin/google", line 5, in
    pkg_resources.run_script('googlecl==0.9.13', 'google')
    File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 499, in run_script
    self.require(requires)[0].run_script(script_name, ns)
    File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1235, in run_script
    execfile(script_filename, namespace, namespace)
    File "/usr/local/lib/python2.7/dist-packages/googlecl-0.9.13-py2.7.egg/EGG-INFO/scripts/google", line 989, in
    main()
    File "/usr/local/lib/python2.7/dist-packages/googlecl-0.9.13-py2.7.egg/EGG-INFO/scripts/google", line 975, in main
    run_once(options, args)
    File "/usr/local/lib/python2.7/dist-packages/googlecl-0.9.13-py2.7.egg/EGG-INFO/scripts/google", line 769, in run_once
    raise run_error
    AttributeError: 'module' object has no attribute 'DOCLIST_FEED_URI'

    This particular error can be fixed by replacing "gdata.docs.data.DOCLIST_FEED_URI" with "self.DOCLIST_FEED_URI" in docs/client.py, but there're also other errors.

    I can reproduce with the latest SVN snapshot of googlecl and python-gdata 2.0.17 from Debian. By the way, this bug blocks release of Debian wheezy (http://bugs.debian.org/664989).

    Can you please fix the remaining issues?

    ReplyDelete