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
I'm sure I've read this project's Issues of README.
What happened?
I run this code.
importtranslatorsproxies= {"https": "http://127.0.0.1:7890/"}
# proxies = {}text=translators.translate_text(
query_text="i have a pen",
from_language="en",
to_language="zh",
translator="baidu",
proxies=proxies,
)
print(text)
I am sure this proxy is right.
Then I get this output:
Using region Central and Western District server backend.
Traceback (most recent call last):
File "/home/shixinchai/mine/projects/Utils/dict/./new.py", line 536, in<module>
text = translators.translate_text(
File "/home/shixinchai/.local/lib/python3.10/site-packages/translators/server.py", line 5294, in translate_text
return self.translators_dict[translator](query_text=query_text, from_language=from_language, to_language=to_language, **kwargs)
File "/home/shixinchai/.local/lib/python3.10/site-packages/translators/server.py", line 104, in _wrapper
return func(*args, **kwargs)
File "/home/shixinchai/.local/lib/python3.10/site-packages/translators/server.py", line 273, in _wrapper
return func(*args, **{**kwargs, **{'query_text': query_text}})
File "/home/shixinchai/.local/lib/python3.10/site-packages/translators/server.py", line 718, in baidu_api
return data if is_detail_result else'\n'.join([item['dst'] foritemin data['data']])
KeyError: 'data'
However, if I set from_language as "auto", everything works fine.
APP Version
translators v5.8.7
Python Version
3.10
Runtime Environment
Linux Ubuntu
Country/Region
Central and Western District
Relevant log output
No response
Screenshots
No response
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
@Old-Farmer It's not a proxy problem, you try setting from_language to auto and it should be fine. Then you try to use longer sentences and then change the from_language and it doesn't seem to be a problem. Therefore, I do not know how this problem is handled within the translation service.
By the way, pip install --upgrade translators==5.8.8
Debug Tips
What happened?
I run this code.
I am sure this proxy is right.
Then I get this output:
However, if I set from_language as "auto", everything works fine.
APP Version
translators v5.8.7
Python Version
3.10
Runtime Environment
Linux Ubuntu
Country/Region
Central and Western District
Relevant log output
No response
Screenshots
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: