salimoha / googlecl

Automatically exported from code.google.com/p/googlecl
0 stars 0 forks source link

"google docs edit --format html" does not work as expected #411

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use "--format html" when attempting to edit a google doc

What is the expected output? What do you see instead?
Expected behavior: Open HTML format copy of selected google document.

Instead, the following traceback is provided:

Traceback (most recent call last):
  File "/usr/bin/google", line 849, in <module>
    main()
  File "/usr/bin/google", line 835, in main
    run_once(options, args)
  File "/usr/bin/google", line 627, in run_once
    task.run(client, options, args)
  File "/usr/lib64/python2.6/site-packages/googlecl/docs/__init__.py", line 202, in _run_edit
    folder_entry_or_path=folder_entry or options.folder)
  File "/usr/lib64/python2.6/site-packages/googlecl/docs/base.py", line 118, in edit_doc
    self.Export(doc_entry_or_title.content.src, path)
  File "/usr/lib64/python2.6/site-packages/googlecl/docs/client.py", line 147, in export
    auth_token=auth_token, **kwargs)
  File "/usr/lib64/python2.6/site-packages/gdata/docs/client.py", line 501, in download
    self._download_file(url, file_path, auth_token=auth_token, **kwargs)
  File "/usr/lib64/python2.6/site-packages/googlecl/docs/client.py", line 92, in _download_file
    response_string = self.get_file_content(uri, auth_token=auth_token)
  File "/usr/lib64/python2.6/site-packages/gdata/docs/client.py", line 76, in get_file_content
    server_response = self.request('GET', uri, auth_token=auth_token, **kwargs)
  File "/usr/lib64/python2.6/site-packages/googlecl/client.py", line 60, in retry_request
    return self.retry_operation(*args, **kwargs)
  File "/usr/lib64/python2.6/site-packages/googlecl/base.py", line 382, in retry_operation
    raise err
gdata.client.RequestError: Server responded with: 400, <!DOCTYPE html><html 
lang="en"><head><meta name="description" content="Web word processing, 
presentations and spreadsheets"><link rel="shortcut icon" 
href="https://ssl.gstatic.com/docs/documents/images/kix-favicon2.ico"><title>Goo
gle Docs -- Page Not Found</title><style
[--- truncated, the rest of the message is an error page. the important info is 
shown above ---]

What version of the product are you using?
$ google --version
google 0.9.13

On what operating system?
Gentoo

What version of gdata-python-client (aka python-gdata)?
[ebuild   R    ] dev-python/gdata-2.0.14  USE="-examples" 0 kB

Please provide any additional information below.
After doing some research, I found that this is a regression of a fix that was 
made for googlecl with a workaround that was provided in the apps-api-issues 
tracker:

http://code.google.com/a/google.com/p/apps-api-issues/issues/detail?id=2294

Apparently the API at some point stopped responding to exportFormat=html, and 
the workaround was to specify the format "102" instead.

The following lines are in googlecl/docs/client.py:

      # Hack for apps-api-issues Issue 2294
      if export_format.lower() == 'html':
        export_format = '102'

From the above traceback/error page, it would appear that "102" is no longer a 
valid format recognized by the API. Removing the above lines corrects the 
behavior. I verified that the above code was still in svn and have attached a 
patch to this report that removes these lines.

Original issue reported on code.google.com by spruchnu...@gmail.com on 6 Aug 2011 at 7:38

Attachments:

GoogleCodeExporter commented 9 years ago
Is there any fix or workaround for this issue?

Original comment by troddinr...@gmail.com on 16 Dec 2014 at 4:56