GoogleTrans突然停止工作并给出错误 [英] GoogleTrans suddenly stopped working and giving error

查看:172
本文介绍了GoogleTrans突然停止工作并给出错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用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:

  1. Googletrans API错误-每日限制或IP受到限制?
  2. 为什么python googletrans突然不起作用?
  3. GoogleTrans API错误-预期值:第1行第1列(字符0)
  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)

这是我的代码:

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆