TypeError: 'NoneType' object is not iterable; when translate words disappointed and delicious from english to italian
Franz95 opened this issue · 5 comments
Googletrans version:
- 4.0.0rc1
- 3.1.0a0
- 3.0.0
- 2.x
I'm submitting a ...
- bug report
- feature request
Current behavior:
When try to translate a phrase like "Disappointed!" and "Delicious", in any form like "disappointed" or "disappointed!." or "DELICIOUS!" and so on, the library returns the TypeError described in the title.
Expected behavior:
Translate the word "Disappointed" to "Deluso".
Translate the word "Delicious" to "Delizioso".
Steps to reproduce:
Run one of the codes in Related code.
Related code:
Example 1
import googletrans
translator = googletrans.Translator()
result=translator.translate('Disappinted!', src='en', dest='it')
print(result.text)
Example 2
import googletrans
translator = googletrans.Translator()
result=translator.translate('DELICIOUS!!', src='en', dest='it')
print(result.text)
Other information:
I think the error is caused by the fact that in Italian Disappointed and Delicious, if there isn't a specific subject that indicates if translate them in male or female form, are translatable in "Deluso" or "Delusa" (for disappointed) and "Delizioso" or "Deliziosa" (for delicious) .
Same issue for word 'teacher' from English to German or 'dog' from English to Spanish
I tried looking into the error, but I can't find the line that is referenced in client.py . Really weird...
File "/home/leon/.local/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
The problem with the version that you are using is that it can not translate for gender-specific translations. I have tried using another version that is “googletrans==3.1.0a0”. It worked for me.
@jaidi422 thanks..rolling back worked for me too.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
The problem with the version that you are using is that it can not translate for gender-specific translations. I have tried using another version that is “googletrans==3.1.0a0”. It worked for me.
Thanks, I had the same problem