I recently used the tableau_tools library to do automated translations of field labels and ran into this issue.
When running the translate_captions operation from the tableau_document.py file, the getroot() call would throw an error. I am new to Python but if I understood it correctly, this call is not needed here since it would return the root of the XML branch but we want to select columns in this operation, which are nested children.
After removing the getroot() calls, the operation seems to work correctly.
For reference, my new version of this operation:
def translate_captions(self):
self.start_log_block()
for column in self.columns_list:
if column.get('caption') is None:
trans = self.__find_translation(column.get('name'))
else:
# Try to match caption first, if not move to name
self.log('Existing caption')
trans = self.__find_translation(column.get('caption'))
if trans is None:
trans = self.__find_translation(column.get('name'))
if trans is not None:
column.set('caption', trans)
self.end_log_block()
Version 4.6.1 which is available now has significant updates to this code and much better documentation of it in the README file. That should fix this issue. Please let me know if it is still a problem.
I recently used the tableau_tools library to do automated translations of field labels and ran into this issue.
When running the translate_captions operation from the tableau_document.py file, the getroot() call would throw an error. I am new to Python but if I understood it correctly, this call is not needed here since it would return the root of the XML branch but we want to select columns in this operation, which are nested children.
After removing the getroot() calls, the operation seems to work correctly.
For reference, my new version of this operation: