运行main.py出现报错,TypeError: As of 3.10, the *loop* parameter was removed from Lock() since it is no longer necessary
lennon624 opened this issue · 3 comments
lennon624 commented
`[2022-12-10 00:59:25.745] main.py (69) - [INFO] : 程序启动完成
2022-12-10 00:59:25 - WARNING 未找到可用的 ASGI 服务,反向 WebSocket 和 WebHook 上报将不可用。
仅 HTTP 轮询与正向 WebSocket 可用。
建议安装 ASGI 服务器,如 `uvicorn` 或 `hypercorn`。
在命令行键入:
pip install uvicorn
或者
pip install hypercorn
[2022-12-10 00:59:25.746] bot.py (260) - [WARNING] : 未找到可用的 ASGI 服务,反向 WebSocket 和 WebHook 上报将不可用。
仅 HTTP 轮询与正向 WebSocket 可用。
建议安装 ASGI 服务器,如 `uvicorn` 或 `hypercorn`。
在命令行键入:
pip install uvicorn
或者
pip install hypercorn
2022-12-10 00:59:25 - ERROR As of 3.10, the *loop* parameter was removed from Lock() since it is no longer necessary
[2022-12-10 00:59:25.751] base.py (43) - [ERROR] : As of 3.10, the *loop* parameter was removed from Lock() since it is no longer necessary
Exception in thread Thread-2 (run):
Traceback (most recent call last):
File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/usr/lib/python3.10/threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.10/dist-packages/mirai/bot.py", line 197, in run
MiraiRunner(self).run(host, port, asgi_server, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/mirai/bot.py", line 274, in run
asyncio.run(self._run())
File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
return future.result()
File "/usr/local/lib/python3.10/dist-packages/mirai/bot.py", line 238, in _run
await self.startup()
File "/usr/local/lib/python3.10/dist-packages/mirai/bot.py", line 226, in startup
await asyncio.gather(*coros)
File "/usr/local/lib/python3.10/dist-packages/mirai/bot.py", line 135, in startup
await self._adapter.login(self.qq)
File "/usr/local/lib/python3.10/dist-packages/mirai/adapters/base.py", line 35, in wrapped
return await func(self, *args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/mirai/adapters/websocket.py", line 187, in login
self.connection = await connect(self.host_name, extra_headers=headers)
File "/usr/local/lib/python3.10/dist-packages/websockets/legacy/client.py", line 622, in __await_impl__
transport, protocol = await self._create_connection()
File "/usr/lib/python3.10/asyncio/base_events.py", line 1089, in create_connection
transport, protocol = await self._create_connection_transport(
File "/usr/lib/python3.10/asyncio/base_events.py", line 1107, in _create_connection_transport
protocol = protocol_factory()
File "/usr/local/lib/python3.10/dist-packages/websockets/legacy/client.py", line 160, in __init__
super().__init__(**kwargs)
File "/usr/local/lib/python3.10/dist-packages/websockets/legacy/protocol.py", line 154, in __init__
self._drain_lock = asyncio.Lock(
File "/usr/lib/python3.10/asyncio/locks.py", line 78, in __init__
super().__init__(loop=loop)
File "/usr/lib/python3.10/asyncio/mixins.py", line 17, in __init__
raise TypeError(
TypeError: As of 3.10, the *loop* parameter was removed from Lock() since it is no longer necessary`
可能是python版本问题,一会升级3.9.x试试
lennon624 commented
[2022-12-10 00:59:25.745] main.py (69) - [INFO] : 程序启动完成
2022-12-10 00:59:25 - WARNING 未找到可用的 ASGI 服务,反向 WebSocket 和 WebHook 上报将不可用。
仅 HTTP 轮询与正向 WebSocket 可用。
建议安装 ASGI 服务器,如 `uvicorn` 或 `hypercorn`。
在命令行键入:
pip install uvicorn
或者
pip install hypercorn
[2022-12-10 00:59:25.746] bot.py (260) - [WARNING] : 未找到可用的 ASGI 服务,反向 WebSocket 和 WebHook 上报将不可用。
仅 HTTP 轮询与正向 WebSocket 可用。
建议安装 ASGI 服务器,如 `uvicorn` 或 `hypercorn`。
在命令行键入:
pip install uvicorn
或者
pip install hypercorn
2022-12-10 00:59:25 - ERROR As of 3.10, the *loop* parameter was removed from Lock() since it is no longer necessary
[2022-12-10 00:59:25.751] base.py (43) - [ERROR] : As of 3.10, the *loop* parameter was removed from Lock() since it is no longer necessary
Exception in thread Thread-2 (run):
Traceback (most recent call last):
File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/usr/lib/python3.10/threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.10/dist-packages/mirai/bot.py", line 197, in run
MiraiRunner(self).run(host, port, asgi_server, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/mirai/bot.py", line 274, in run
asyncio.run(self._run())
File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
return future.result()
File "/usr/local/lib/python3.10/dist-packages/mirai/bot.py", line 238, in _run
await self.startup()
File "/usr/local/lib/python3.10/dist-packages/mirai/bot.py", line 226, in startup
await asyncio.gather(*coros)
File "/usr/local/lib/python3.10/dist-packages/mirai/bot.py", line 135, in startup
await self._adapter.login(self.qq)
File "/usr/local/lib/python3.10/dist-packages/mirai/adapters/base.py", line 35, in wrapped
return await func(self, *args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/mirai/adapters/websocket.py", line 187, in login
self.connection = await connect(self.host_name, extra_headers=headers)
File "/usr/local/lib/python3.10/dist-packages/websockets/legacy/client.py", line 622, in __await_impl__
transport, protocol = await self._create_connection()
File "/usr/lib/python3.10/asyncio/base_events.py", line 1089, in create_connection
transport, protocol = await self._create_connection_transport(
File "/usr/lib/python3.10/asyncio/base_events.py", line 1107, in _create_connection_transport
protocol = protocol_factory()
File "/usr/local/lib/python3.10/dist-packages/websockets/legacy/client.py", line 160, in __init__
super().__init__(**kwargs)
File "/usr/local/lib/python3.10/dist-packages/websockets/legacy/protocol.py", line 154, in __init__
self._drain_lock = asyncio.Lock(
File "/usr/lib/python3.10/asyncio/locks.py", line 78, in __init__
super().__init__(loop=loop)
File "/usr/lib/python3.10/asyncio/mixins.py", line 17, in __init__
raise TypeError(
TypeError: As of 3.10, the *loop* parameter was removed from Lock() since it is no longer necessary
格式乱了。。重新发下
RockChinQ commented
解决办法
-
由安装器进行部署的,到安装器目录执行以下指令
- Linux
python/bin/pip install websockets --upgrade
- Windows
python\Scripts\pip3 install websockets --upgrade
- Linux
-
手动部署的
pip3 install websockets --upgrade
yirimirai默认安装的websockets库版本过低,参见YiriMiraiProject/YiriMirai#49
Ajwyunsx commented
Traceback (most recent call last): File "main.py", line 14, in from pkg.utils.log import init_runtime_log_file, reset_logging File "/home/ajw/QChatGPT/pkg/utils/init.py", line 1, in from .threadctl import ThreadCtl File "/home/ajw/QChatGPT/pkg/utils/threadctl.py", line 52 def submit(self, pool: Pool, fn, /, *args, **kwargs ):