GoogleTrans突然停止工作并给出错误 [英] GoogleTrans suddenly stopped working and giving error
问题描述
使用googletrans时,我无法将我的文本翻译成任何语言.我正在使用python3来实现.
While using googletrans, I am unable to translate my text into any language. I am using python3 to do so.
我在Google上搜索了许多与我的问题有关的东西,并在Stack Overflow上找到了许多答案,这表明可能存在字符限制或IP被限制的问题.但这不是我的情况.前段时间它运行良好,现在却出错了.而且,如果我在Google Collab上运行了相同的代码,它就可以正常工作.
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.
我尝试过:清除缓存;重启我的系统两次;删除googletrans文件夹并重新安装.我还在Spyder和Jupyter笔记本上尝试了该代码,但它给了我同样的错误.
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答案是:
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)
这是我的代码:
from googletrans import Translator
translator = Translator()
trans = translator.translate("ajj bht garmi hai").text
trans
我遇到了错误:
JSONDecodeError:期望值:第1行第1列(字符0)
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
推荐答案
目前运行良好,昨天似乎是API的问题.
Its working fine right now, it seems as a problem with the API yesterday.
这篇关于GoogleTrans突然停止工作并给出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!