Closed SteniMariyaThomas closed 11 months ago
See #142
@SteniMariyaThomas Hello friend, please give me more error information! Whether the version is 5.8.3 or not?
@UlionTse Yes the version is 5.8.3. Issue exists in previous version also
@SteniMariyaThomas Try ts.get_languages('google')
. Whether you made a high-frequency request, or first request shows error?
>>> import translators as ts
>>> ts.get_languages('google')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/homebrew/lib/python3.11/site-packages/translators/server.py", line 5204, in get_languages
_ = self._test_translate(_ts=translator)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/translators/server.py", line 5188, in _test_translate
result = self.translators_dict[_ts](
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/translators/server.py", line 104, in _wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/translators/server.py", line 261, in _wrapper
return func(*args, **{**kwargs, **{'query_text': query_text}})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/translators/server.py", line 599, in google_api
from_language, to_language = self.check_language(from_language, to_language, self.language_map, output_zh=self.output_zh)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/translators/server.py", line 174, in check_language
raise TranslatorError('Unsupported to_language[{}] in {}.'.format(to_language, sorted(language_map.keys())))
translators.server.TranslatorError: Unsupported to_language[en] in [].
@ManuelSchneid3r Bro, you should update version, v5.8.5 shouldn't show errors like yours.
>>> ts.__version__
'5.8.5'
>>> ts.get_languages('google')
{'auto': 'en', 'zh-CN': 'en', 'en': 'zh-CN'}
@SteniMariyaThomas Hello friend, please give me more error information! Whether the version is 5.8.3 or not?
Its 5.8.3
@ManuelSchneid3r Why? Which country or region are you in? Is it because Google offers different services in different regions?
@ManuelSchneid3r Can you send me your host_html about https://translate.google.com, my email is uliontse@outlook.com
, thanks.
@SteniMariyaThomas Try
ts.get_languages('google')
. Whether you made a high-frequency request, or first request shows error?
both cases
@ManuelSchneid3r Why? Which country or region are you in? Is it because Google offers different services in different regions?
@SteniMariyaThomas Same question.
@ManuelSchneid3r Can you send me your host_html about https://translate.google.com, my email is
uliontse@outlook.com
, thanks.
@SteniMariyaThomas Both helps.
@SteniMariyaThomas Try
ts.get_languages('google')
. Whether you made a high-frequency request, or first request shows error?both cases
@ManuelSchneid3r high-frequency request, and you?
Nope, single request from python shell
@ManuelSchneid3r Can you send me your host_html about https://translate.google.com, my email is
uliontse@outlook.com
, thanks.
How can I obtain the host_html? You mean the website source code?
@ManuelSchneid3r Can you send me your host_html about https://translate.google.com, my email is
uliontse@outlook.com
, thanks.How can I obtain the host_html? You mean the website source code?
@ManuelSchneid3r Yeah.
btw bavaria backend was chosen (germany)
@ManuelSchneid3r
Thanks for your html, bro.
But look at this, you can get_languages('google')
.
I dont know where the problem stems from, but its still …
>>> import translators as ts
>>> ts.__version__
'5.8.5'
>>> ts.get_languages('google')
{'auto': 'en', 'zh-CN': 'en', 'en': 'zh-CN'}
@ManuelSchneid3r @Cabu Bros, please pip install --upgrade translators==5.8.6
.
works, ty 👍
Debug Tips
What happened?
While translating an arabic content to english using translator server: google, I am getting error
Unsupported from_language[ar] in []
On further research I found that language_map is getting as empty.
And
urllib.parse.urlparse(r.url).hostname is consent.google.com
. Based on that while getting consent cookie input_element is emptyinput_element = et.xpath('.//input[@type="hidden"][@name="v"]')
It was working previously. Now failing to translate due to this error. I am using latest version of translators
Any help will be greatly appreciated!
APP Version
0.0.1(example)
Python Version
3.9 (Default)
Runtime Environment
Linux CentOS (Default)
Country/Region
Dubai
Relevant log output
No response
Screenshots
Code of Conduct