Skip to content

download_document fails on original document format docx #23

@maharg101

Description

@maharg101

When downloading a pre-translated document using is_xliff="false" the download_document attempts to decode the api response as UTF-8, which results in a UnicodeDecodeError.

To reproduce, upload a docx file for pretranslation. Once processed, download:

api_instance.download_document(job_id, is_xliff="false")

Observe the following error:

  File "/path/to/src/lilt-pipeline-wrapper/venv/lib/python3.7/site-packages/lilt/api_client.py", line 205, in __call_api
    response_data.data = response_data.data.decode(encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xce in position 10: invalid continuation byte

I found mention of a bytes response type at

if six.PY3 and response_type not in ["file", "bytes"]:
but it is not clear if / how this may be used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions