Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is an error in translating "cat" into French #394

Open
2 of 6 tasks
goshut opened this issue Jan 24, 2024 · 2 comments
Open
2 of 6 tasks

There is an error in translating "cat" into French #394

goshut opened this issue Jan 24, 2024 · 2 comments

Comments

@goshut
Copy link

goshut commented Jan 24, 2024

Googletrans version:

  • 4.0.0rc1
  • 3.1.0a0
  • 3.0.0
  • 2.x

I'm submitting a ...

  • bug report
  • feature request

Current behavior:

Traceback (most recent call last):
  File "d:\test\python_test_2-17\translater_test\google_test1.py", line 4, in <module>
    print(translator.translate("cat", "fr"))
  File "D:\python\virtualenv\OCR\lib\site-packages\googletrans\client.py", line 222, in translate
    translated_parts = list(map(lambda part: TranslatedPart(part[0], part[1] if len(part) >= 2 else []), parsed[1][0][0][5]))
TypeError: 'NoneType' object is not iterable

Expected behavior:

Steps to reproduce:

Related code:

from googletrans import Translator

translator = Translator()
print(translator.translate("cat", "fr"))

Other information:
I found this issue while processing Bing translation, which returned an HTML file instead of JSON format data Later, I used this library and found the same problem.

@ArtiomOn
Copy link

Same thing for word "users" into Spanish.

from googletrans import Translator
translator = Translator()
print(translator.translate("users", "es"))

Traceback:

Traceback (most recent call last):
  File "/home/artic/.local/share/JetBrains/Toolbox/apps/pycharm-professional/plugins/python/helpers/pydev/pydevconsole.py", line 364, in runcode
    coro = func()
  File "<input>", line 4, in <module>
  File "/home/artic/PycharmProjects/legaltech_backend/.venv/lib/python3.10/site-packages/googletrans/client.py", line 222, in translate
    translated_parts = list(map(lambda part: TranslatedPart(part[0], part[1] if len(part) >= 2 else []), parsed[1][0][0][5]))
TypeError: 'NoneType' object is not iterable

@yellowtapes
Copy link

Apparently the word "Obvious" for spanish well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants