Skip to content

Discord bot Not translating  #112

@AYMBotBuildersOfficial

Description

@AYMBotBuildersOfficial

I am using translate for a discord bot, and when I put with a deepL free API key, it is not translate and when i did error logging I got
An error occurred: Expecting value: line 1 column 1 (char 0)

I tried official given code in the PyPI page but it also not working, it gives error:

Traceback (most recent call last):
File "/home/funz/testing.py", line 9, in
translated_text = translator.translate('the book is on the table')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/funz/end/lib/python3.11/site-packages/translate/translate.py", line 45, in translate
return ' '.join(self.provider.get_translation(text_wraped) for text_wraped in text_list)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/funz/end/lib/python3.11/site-packages/translate/translate.py", line 45, in
return ' '.join(self.provider.get_translation(text_wraped) for text_wraped in text_list)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/funz/end/lib/python3.11/site-packages/translate/providers/deepl.py", line 48, in get_translation
return data["translations"][0]["text"]
~~~~^^^^^^^^^^^^^^^^
KeyError: 'translations'

I think this error might be same reason why bot's script also won't translate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions