I'm trying to run a simple volume-get-iter against a number of our clusters, and then using xmltodict I want to convert the XML to a dictionary so that I can simply dump it in json format. It's working fine for all but one of our cdot clusters, but I think it's breaking on a cluster where there may be an odd character in a volume name.
File "./y.py", line 39, in <module>
xml_parser = out.sprintf()
File "/local/mnt/netappsplunk/NaElement.py", line 236, in sprintf
s = s+c.sprintf(indent + "\t")
File "/local/mnt/netappsplunk/NaElement.py", line 236, in sprintf
s = s+c.sprintf(indent + "\t")
File "/local/mnt/netappsplunk/NaElement.py", line 236, in sprintf
s = s+c.sprintf(indent + "\t")
File "/local/mnt/netappsplunk/NaElement.py", line 236, in sprintf
s = s+c.sprintf(indent + "\t")
File "/local/mnt/netappsplunk/NaElement.py", line 239, in sprintf
s = s + str(self.element['content'])
UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position 30: ordinal not in range(128)
I tried to just do a replace, but that fails:
out = (s.invoke_elem(volume_list)).replace('\\xa0', ' ')
AttributeError: NaElement instance has no attribute 'replace'
Is there a way to make this work?