Trying to use googletrans in my project, using version 4.0.0-rc.1, Python 13.10 on Windows 10 local machine.
The script is simple, it must translate an array of the phrases into English from Russian. When trying to translate one phrase - it's ok, but when trying to translate a dictionary - the error occurs:
Traceback (most recent call last):
File "c:\Users\fire\Dropbox\my_soft\python_code_lessons\py_version.py", line 107, in <module>
translated = tr.translate(data, dest='en')
File "C:\Users\fire\Dropbox\my_soft\python_code_lessons\venv\lib\site-packages\googletrans\client.py", line 219, in translate
parsed = json.loads(data[0][2])
File "C:\Users\fire\AppData\Local\Programs\Python\Python310\lib\json\__init__.py", line 339, in loads
raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not NoneType
Part of the script where this error occurs:
import googletrans
from googletrans import Translator
print(googletrans.__version__)
tr = Translator()
data = ['привет', 'мой мир', 'лучший']
translated = tr.translate(data, dest='en')
for trans in translated:
print(f'{trans.origin} -> {trans.text}')
Where should I dig? Or maybe someone had such a problem?
