问题
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:
- Googletrans API error - daily limit or blocked IP?
- why python googletrans suddenly not working?
- 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