How to fix: AttributeError: 'NoneType' object has no attribute 'group'
How to fix: AttributeError: 'NoneType' object has no attribute 'group'
我是运行以下代码:-
from googletrans import Translator, constants
from pprint import print
# init the Google API translator
translator = Translator()
# translate a spanish text to english text (by default)
translation = translator.translate("Hola Mundo")
print("{} ({}) --> {} ({})".format(translation.origin, translation.src, translation.text, translation.dest))
虽然 运行 这段代码,但我得到的错误是:AttributeError: 'NoneType' object has no attribute 'group'
我不知道如何解决这个错误。
我在 Whosebug 上看到了其他答案,但这些都没有用。
有人知道怎么解决吗?
以下是完整错误的截图:-
要修复此错误,您必须卸载当前的 googletrans 版本并使用以下命令安装新版本:
pip3 uninstall googletrans
pip3 install googletrans==3.1.0a0
运行 再次输入代码,应该可以修复错误。
我是运行以下代码:-
from googletrans import Translator, constants
from pprint import print
# init the Google API translator
translator = Translator()
# translate a spanish text to english text (by default)
translation = translator.translate("Hola Mundo")
print("{} ({}) --> {} ({})".format(translation.origin, translation.src, translation.text, translation.dest))
虽然 运行 这段代码,但我得到的错误是:AttributeError: 'NoneType' object has no attribute 'group'
我不知道如何解决这个错误。
我在 Whosebug 上看到了其他答案,但这些都没有用。
有人知道怎么解决吗?
以下是完整错误的截图:-
要修复此错误,您必须卸载当前的 googletrans 版本并使用以下命令安装新版本:
pip3 uninstall googletrans
pip3 install googletrans==3.1.0a0
运行 再次输入代码,应该可以修复错误。