GoogleTrans suddenly stopped working and giving error

强颜欢笑 提交于 2020-04-30 10:08:25

问题


While using googletrans, I am unable to translate my text into any language. I am using python3 to do so.

I have googled many things related to my question and have found many answers on Stack Overflow about it suggesting that there could be a limit issue of characters or IP blocked. But this isn't the case with me. It was working fine some time ago and now it's giving error. And if I ran same code on Google Collab it works fine.

I have tried: clearing the cache; restarting my system twice; deleting the googletrans folder and re-installing. I have also tried the code on Spyder and on Jupyter notebook, but it gives me the same error.

Stack Overflow answers which I found but were of no help are:

  1. Googletrans API error - daily limit or blocked IP?
  2. why python googletrans suddenly not working?
  3. GoogleTrans API Error - Expecting value: line 1 column 1 (char 0)

This is my code:

from googletrans import Translator
translator = Translator()
trans = translator.translate("ajj bht garmi hai").text
trans

I am getting the error:

JSONDecodeError: Expecting value: line 1 column 1 (char 0)


回答1:


Its working fine right now, it seems as a problem with the API yesterday.



来源:https://stackoverflow.com/questions/61042396/googletrans-suddenly-stopped-working-and-giving-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!