document-api-python
document-api-python copied to clipboard
xfile - Issue opening a .twbx containing custom geocoding
Hello,
I was trying to open a 9.3 workbook with custom geocoding attached. find_file_in_zip() evaluates .tds files as well as .twb files when opening a .twbx. A .twbx can contain .tds files if it contains custom geocoding.
I'm not quite sure what determines the order of the filenames in candidate_files, but if a .tds happens to end up before a .tdw in the list, the .tds will be evaluated first as a workbook. This raises the TableauInvalidFileException: filename is not a valid 'workbook' file.
I cannot share the workbook (it contains private data), I can share some screenshots of its contents:
A suggested fix for this would be to only check for .twb's if the file is a .twb/.twbx.
Cheers, Marco
Forgot to add: I've tried this with both the development as the master branch version of xfile.py
Darn, I was really hoping to keep that layer clear of too much reliance on the input file extension... but we may have to go back to doing something like that to avoid these types of bugs.
Thanks for reporting!
If I'm not mistaken, the .twb or .tds file in a .twbx or .tdsx will always be in the root of the archive. If I'm also not mistaken, all other file are always in a folder. So you could possibly just look at the files in the root to find the file you're looking for. Again not 100% sure this will work, just a suggestion :)
@itsmarco excellent suggestion, I'll see what I can whip up!