root@xxx:/opt# python3 google_translate_util.py
Traceback (most recent call last):
File "google_translate_util.py", line 29, in <module>
print(translate(text, "zh"))
File "google_translate_util.py", line 19, in translate
return translator.translate(text, lang_tgt=lang_type)
File "/usr/local/lib/python3.6/dist-packages/google_trans_new/google_trans_new.py", line 188, in translate
raise e
File "/usr/local/lib/python3.6/dist-packages/google_trans_new/google_trans_new.py", line 152, in translate
response = json.loads(response)
File "/usr/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.6/json/decoder.py", line 342, in decode
raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 1 column 3085 (char 3084)
modify
/usr/local/lib/python3.6/dist-packages/google_trans_new/google_trans_new.py` line 151
response = (decoded_line + ']') modify to response = (decoded_line)
install
translate
modify
Test