diff --git a/tableaudocumentapi/datasource.py b/tableaudocumentapi/datasource.py index dd3d5c5..69318ed 100644 --- a/tableaudocumentapi/datasource.py +++ b/tableaudocumentapi/datasource.py @@ -31,7 +31,7 @@ def _get_metadata_xml_for_field(root_xml, field_name): if "'" in field_name: field_name = sax.escape(field_name, {"'": "'"}) - xpath = ".//metadata-record[@class='column'][local-name='{}']".format(field_name) + xpath = u".//metadata-record[@class='column'][local-name='{}']".format(field_name) return root_xml.find(xpath) diff --git a/tableaudocumentapi/field.py b/tableaudocumentapi/field.py index 63cc72c..65ce78d 100644 --- a/tableaudocumentapi/field.py +++ b/tableaudocumentapi/field.py @@ -199,4 +199,9 @@ def _read_description(xmldata): if description is None: return None - return u'{}'.format(ET.tostring(description, encoding='utf-8')) # This is necessary for py3 support + description_string = ET.tostring(description, encoding='utf-8') + # Format expects a unicode string so in Python 2 we have to do the explicit conversion + if isinstance(description_string, bytes): + description_string = description_string.decode('utf-8') + + return description_string
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: