Unable to upload files larger than 20mb
Publish call fails for extracts larger than 20mb.
The error occurs when tableau_rest_api_connection.py runs append_to_file_upload, specifically the publish += content. The error is TypeError: must be str, not bytes.
I dug in and can change the single_upload_limit to 64, but that doesn't solve the problem for extracts larger than this.
I've seen similar issues reported for workbooks, but I guess they both use the same functions.
Actually Fixed this by modifying the function to become inline with code above it:
def append_to_file_upload(self, upload_session_id, content, filename):
boundary_string = self.generate_boundary_string()
publish_request = bytes("--{}\r\n".format(boundary_string).encode('utf-8'))
publish_request += bytes('Content-Disposition: name="request_payload"\r\n'.encode('utf-8'))
publish_request += bytes('Content-Type: text/xml\r\n\r\n'.encode('utf-8'))
publish_request += bytes('\r\n'.encode('utf-8'))
publish_request += bytes("--{}\r\n".format(boundary_string).encode('utf-8'))
publish_request += bytes('Content-Disposition: name="tableau_file"; filename="{}"\r\n'.format(
filename).encode('utf-8'))
publish_request += bytes('Content-Type: application/octet-stream\r\n\r\n'.encode('utf-8'))
publish_request += content
publish_request += bytes("\r\n--{}--".format(boundary_string).encode('utf-8'))
url = self.build_api_url("fileUploads/{}".format(upload_session_id))
self.send_append_request(url, publish_request, boundary_string)
I'm encountering the same issue. However when I try to apply your fix, I am getting the original error message but for the line: publish_request += bytes('Content-Disposition: name="tableau_file"; filename="{}"\r\n'.format( filename).encode('utf-8'))
Do you have any recommendations?
I'm not sure - can you paste in here the whole of the error message?
Can anyone confirm if they are still seeing this issue with latest versions. I just released a 5.X version that is rewritten specifically for Python 3.6 and hopefully doesn't encounter any of the encoding issues that arose from the automatic translation like before
I had this issue with Python 3.7.6. Solution above by @kabelak fixed it for me. I'm a Python amateur, so not sure best information to provide, but if you tell me what's useful, I'll get it for you. Btw thanks for this v useful package.
I've also had this issue today, the fix above from @kabelak has also worked for me. Please merge into master branch :)