carolinux / gdata-python-client

Automatically exported from code.google.com/p/gdata-python-client
0 stars 1 forks source link

Row in spreadsheet can not be updated if the column name contains non-latin symbols. #628

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

Names of column in spreadsheet should contain non-latin symbols (in my case it 
was Russian). I can read values without any problems, but I can't update them. 

I am using 

import atom.service
import gdata.spreadsheets
import gdata.spreadsheets.client
import gdata.gauth
import atom

and when I call 

entry = listfeed.entry[i]               ' get current entry
client.update(entry)                    ' send values back to the server

I get this error:

 File "/usr/local/lib/python2.7/dist-packages/gdata/client.py", line 717, in update
    entry.to_string(get_xml_version(self.api_version)),
  File "/usr/local/lib/python2.7/dist-packages/atom/core.py", line 352, in to_string
    tree_string = ElementTree.tostring(self._to_tree(version, encoding))
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1121, in tostring
    ElementTree(element).write(file, encoding, method=method)
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 812, in write
    self._root, encoding, default_namespace
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 879, in _namespaces
    add_qname(tag)
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 853, in add_qname
    qnames[qname] = encode("%s:%s" % (prefix, tag))
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 838, in encode
    return text.encode(encoding)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 4-7: 
ordinal not in range(128)

What version of the product are you using?

I am using last version of the library 2.0.17. Python 2.7.1

Please provide any additional information below.

I have fixed with problem by patching atom/core.py. The patch is attached. 

Original issue reported on code.google.com by Andrej.S...@gmail.com on 17 Jul 2012 at 9:10

Attachments: