Hi all,
I’m trying to create an app using the recent deepl python library. I seem unable to use the library on Qt Creator altough it workds flawlessly on my computer’s terminal.
The python code is called by a QML file that worked with other python codes before. It’s using the io.thp.pyotherside 1.5 library.
Has any of you had the chance to try this library ?
I imported all necessary library files (deepl, requests, idna, urllib3, certifi and charset) into the project in Qt Creator.
When using the following code in my python file :
translator = deepl.Translator(my_key) result = translator.translate_text("hello world!", target_lang="DE") print(result)
I get the following errors :
Traceback (most recent call last): File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner self.run() File "/usr/lib/python3.8/threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "/usr/share/pythonsample/qml/pages/datadownloader.py", line 52, in slow_function result = translator.translate_text("hello world!", target_lang="FR") File "/usr/share/pythonsample/qml/pages/deepl/translator.py", line 655, in translate_text request_data = self._check_language_and_formality( File "/usr/share/pythonsample/qml/pages/deepl/translator.py", line 572, in _check_language_and_formality self._check_valid_languages(source_lang, target_lang) File "/usr/share/pythonsample/qml/pages/deepl/translator.py", line 537, in _check_valid_languages target_lang == lang.code for lang in self.get_target_languages() File "/usr/share/pythonsample/qml/pages/deepl/translator.py", line 935, in get_target_languages self._target_languages_cached = self._request_languages( File "/usr/share/pythonsample/qml/pages/deepl/translator.py", line 499, in _request_languages status, content, json = self._api_call("v2/languages", data=data) File "/usr/share/pythonsample/qml/pages/deepl/translator.py", line 430, in _api_call status_code, content = self._client.request_with_backoff( File "/usr/share/pythonsample/qml/pages/deepl/http_client.py", line 93, in request_with_backoff raise exception File "/usr/share/pythonsample/qml/pages/deepl/http_client.py", line 79, in request_with_backoff response = self.request( File "/usr/share/pythonsample/qml/pages/deepl/http_client.py", line 150, in request raise ConnectionException(message, should_retry=should_retry) deepl.exceptions.ConnectionException: Unexpected connection error: __enter__
Feel free to ask for information I missed sharing !
Have a nice day !