You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,when I use the code to upload the file for translation, the translation reports an error.How can I change my code? deepl.exceptions.DocumentTranslationException: Error occurred while translating document: Failed to open the uploaded document.
This indicates an error on the server side (the server could not open your document). Does this happen consistently, even if you retry the translation? Are you sending a valid document of the supported types?
I encounter the same error when I retry the translation, and I am uploading files of types docx, xlsx, and pptx. Can I provide the docid to help investigate the issue?
Were you using translate_document on a filepath? That method only works with file-like objects, as the docs state. We have translate_document_from_filepath to pass in file paths. See for example our tests on these:
Yes, you are 100% right. translate_document_from_filepath() works fine with a filepath, but my app needs to execute the steps individually, so I had to use translate_document_upload(), translate_document_get_status(), and translate_document_download(). You are right again, the docs state clearly that translate_document_upload() requires a file object or a stream. Thanks!
Activity
JanEbbing commentedon Aug 23, 2024
This indicates an error on the server side (the server could not open your document). Does this happen consistently, even if you retry the translation? Are you sending a valid document of the supported types?
AK47Poi commentedon Aug 23, 2024
I encounter the same error when I retry the translation, and I am uploading files of types docx, xlsx, and pptx. Can I provide the docid to help investigate the issue?
fernandolvwrk commentedon Oct 9, 2024
To solve this problem, do not use the file path, send the file as a binary data stream.
JanEbbing commentedon Oct 9, 2024
Were you using
translate_documenton a filepath? That method only works with file-like objects, as the docs state. We havetranslate_document_from_filepathto pass in file paths. See for example our tests on these:From filepath
From file object
fernandolvwrk commentedon Oct 9, 2024
Yes, you are 100% right.
translate_document_from_filepath()works fine with a filepath, but my app needs to execute the steps individually, so I had to usetranslate_document_upload(),translate_document_get_status(), andtranslate_document_download(). You are right again, the docs state clearly that translate_document_upload() requires a file object or a stream. Thanks!