BUG 4.0.0rc1: TypeError while trying to translate "Formosa" to portuguese
Opened this issue · 1 comments
GarciaNicolas commented
Googletrans version:
- 4.0.0rc1
- 3.1.0a0
- 3.0.0
- 2.x
I'm submitting a ...
- bug report
- feature request
Current behavior:
When I try to translate "Formosa", an argentine province, to portuguese it throws an exception
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[97], [line 3](vscode-notebook-cell:?execution_count=97&line=3)
[1](vscode-notebook-cell:?execution_count=97&line=1) translator = Translator()
----> [3](vscode-notebook-cell:?execution_count=97&line=3) translator.translate("Formosa", dest='pt').text
File ...Python\Python312\Lib\site-packages\googletrans\client.py:222, in Translator.translate(self, text, dest, src)
[220](file:///.../Python/Python312/Lib/site-packages/googletrans/client.py:220) # not sure
[221](file:///.../Python/Python312/Lib/site-packages/googletrans/client.py:221) should_spacing = parsed[1][0][0][3]
--> [222](file:///.../Python/Python312/Lib/site-packages/googletrans/client.py:222) translated_parts = list(map(lambda part: TranslatedPart(part[0], part[1] if len(part) >= 2 else []), parsed[1][0][0][5]))
[223](file:///.../Python/Python312/Lib/site-packages/googletrans/client.py:223) translated = (' ' if should_spacing else '').join(map(lambda part: part.text, translated_parts))
[225](file:///.../Python/Python312/Lib/site-packages/googletrans/client.py:225) if src == 'auto':
TypeError: 'NoneType' object is not iterable
Expected behavior:
It should return "Formosa"
Related code:
from googletrans import Translator
translator = Translator()
translator.translate("Formosa", dest='pt').text
nacho00112 commented
same, but with "Female" when I try to translate it into Spanish