UlionTse / translators

🌏🌍🌎Translators🌎🌍🌏 is a library that aims to bring free, multiple, enjoyable translations to individuals and students in Python. Translators是一个旨在用Python为个人和学生带来免费、多样、愉快翻译的库。
https://pypi.org/project/translators/
GNU General Public License v3.0
1.62k stars 189 forks source link

[Bug]: Unable to find server backend. #153

Closed dvdcjw closed 6 months ago

dvdcjw commented 6 months ago

Debug Tips

What happened?

hey guys I'm trying to make a GUI program right now, I just don't want the user to touch the CLI. Is there anyway to prevent this from happening?

APP Version

5.8.9

Python Version

3.11

Runtime Environment

Windows 10

Country/Region

China

Relevant log output

\Lib\site-packages\translators\server.py:331: UserWarning: Unable to find server backend.
 warnings.warn('Unable to find server backend.\n\n')
Please input your server region need to visit:
eg: [Qatar, China, ...]

Screenshots

No response

Code of Conduct

UlionTse commented 6 months ago

@dvdcjw Hello friend, Attention this ->https://github.com/UlionTse/translators/blob/c20c815ffe0ed75c551eef37d86055d8a8e435c7/translators/server.py#L307, you can add these codes first:

import os

os.environ['translators_default_region'] = 'CN'