我在尝试运行我为 Discord 制作的机器人时遇到了这个错误.这发生在下载一些模块后.有没有办法解决这个问题?
I run into this error when trying to run a bot I made for Discord. This occurred after downloading some modules. Is there any way to fix this?
Traceback (most recent call last):
File "C:UsersJerielDesktopJerryBot
un.py", line 1, in <module>
import discord
File "C:UsersJerielAppDataRoamingPythonPython36site-packagesdiscord\__
init__.py", line 20, in <module>
from .client import Client, AppInfo
File "C:UsersJerielAppDataRoamingPythonPython36site-packagesdiscordcl
ient.py", line 30, in <module>
from .guild import Guild
File "C:UsersJerielAppDataRoamingPythonPython36site-packagesdiscordgu
ild.py", line 39, in <module>
from .channel import *
File "C:UsersJerielAppDataRoamingPythonPython36site-packagesdiscordch
annel.py", line 31, in <module>
from .webhook import Webhook
File "C:UsersJerielAppDataRoamingPythonPython36site-packagesdiscordwe
bhook.py", line 27, in <module>
import aiohttp
File "C:UsersJerielAppDataRoamingPythonPython36site-packagesaiohttp\__
init__.py", line 6, in <module>
from .client import * # noqa
File "C:UsersJerielAppDataRoamingPythonPython36site-packagesaiohttpcl
ient.py", line 15, in <module>
from . import connector as connector_mod
File "C:UsersJerielAppDataRoamingPythonPython36site-packagesaiohttpco
nnector.py", line 17, in <module>
from .client_proto import ResponseHandler
File "C:UsersJerielAppDataRoamingPythonPython36site-packagesaiohttpcl
ient_proto.py", line 6, in <module>
from .http import HttpResponseParser, StreamWriter
File "C:UsersJerielAppDataRoamingPythonPython36site-packagesaiohttpht
tp.py", line 8, in <module>
from .http_parser import (HttpParser, HttpRequestParser, HttpResponseParser,
File "C:UsersJerielAppDataRoamingPythonPython36site-packagesaiohttpht
tp_parser.py", line 15, in <module>
from .http_writer import HttpVersion, HttpVersion10
File "C:UsersJerielAppDataRoamingPythonPython36site-packagesaiohttpht
tp_writer.py", line 304, in <module>
class URL(yarl.URL):
File "C:UsersJerielAppDataRoamingPythonPython36site-packagesyarl\__ini
t__.py", line 230, in __init_subclass__
"is forbidden".format(cls))
TypeError: Inheritance a class <class 'aiohttp.http_writer.URL'> from URL is for
bidden
Discord.py rewrite 分支最近在 requirements.txt 和 aiohttp 支持上出现了一些问题.需要手动安装低版本的 yarl 来支持 discord.py 所需的 aiohttp 库.
Discord.py rewrite branch has some problems recently with its requirements.txt and aiohttp support. You need to manually install a lower version of yarl to support discord.py's required aiohttp library.
您需要运行以下命令:
pip install "yarl<1.2"
<小时>
新版本的 discord.py rewrite 修复了这个问题,您不再需要按照上述解决方案进行操作.正确的做法是从 GitHub 重新下载 discord.py rewrite 并升级包.
The new versions of discord.py rewrite fixed this problem, you no longer need to do follow the aforementioned solution. The correct action to take is to re-download discord.py rewrite from GitHub and upgrade the packages.
这篇关于TypeError:禁止从 URL 继承类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!