Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report][Critical] PyYAML和MAH问题 #157

Closed
Evyde opened this issue Nov 24, 2021 · 15 comments
Closed

[Bug Report][Critical] PyYAML和MAH问题 #157

Evyde opened this issue Nov 24, 2021 · 15 comments
Labels
bug Something isn't working

Comments

@Evyde
Copy link

Evyde commented Nov 24, 2021

环境信息

系统版本: CentOS 7
源码版本: Latest
其他信息: Python 3.8 PyYAML 6.0

问题描述

PyYAML

PyYAML自从6.0开始load()方法需要Loader参数,您requirements.txt里面没有指定版本号,默认安装新版本。
python main.py时,出现:

(QQBot) [root@VM-24-11-centos sagiri-bot]# python main.py 
Traceback (most recent call last):
  File "main.py", line 13, in <module>
    from WebManager.websocket import set_log
  File "/root/QQBot/sagiri-bot/WebManager/websocket.py", line 6, in <module>
    from SAGIRIBOT.utils import get_config
  File "/root/QQBot/sagiri-bot/SAGIRIBOT/utils.py", line 22, in <module>
    from SAGIRIBOT.ORM.AsyncORM import orm
  File "/root/QQBot/sagiri-bot/SAGIRIBOT/ORM/AsyncORM.py", line 29, in <module>
    DB_LINK = get_config("DBLink")
  File "/root/QQBot/sagiri-bot/SAGIRIBOT/ORM/AsyncORM.py", line 22, in get_config
    configs = yaml.load(f.read())
TypeError: load() missing 1 required positional argument: 'Loader'

解决方法:Requirements.txt里面指定PyYAML版本(如5.4)。

MAH

MCL中的默认MAH版本过旧,已经完全无法使用,只能把Core降级或者升级MAH,但MAH 2的API进行了大范围改动,只能选择对Core进行降级,目前所知的能支持MAH 1.x版本运行的最新Core为2.3,已经远远落后于最新稳定版2.7。希望作者能在当前Core版本登录协议未失效前对新的MAH进行适配。

Python

另外,似乎Bot对新版Python兼容性不好,我测试Python 3.9和3.10完全无法运行,其中3.10是Python自己的Bug,3.9不清楚,懒得复现了(

日志

@Evyde Evyde added the bug Something isn't working label Nov 24, 2021
@SAGIRI-kawaii
Copy link
Owner

mah使用1.12,mirai使用2.7.1-dev

@nullqwertyuiop
Copy link

我这里 MAH 1.x 可以支持到 2.7 啊()
一直是用的 Python 3.8 我这里(

@SAGIRI-kawaii
Copy link
Owner

mah2适配在明年开启,使用新框架重构(今年考研)

@nullqwertyuiop
Copy link

加油

@nullqwertyuiop
Copy link

nullqwertyuiop commented Nov 24, 2021

mah 1.12.0 可以支持到稳定版的 2.7.1
目前 debian buster x64 + mah 1.12.0 + mirai-* 2.7.1 + python 3.8 没大问题

@Evyde
Copy link
Author

Evyde commented Nov 24, 2021

MCL默认的是1.10,不适配新的Mirai,是他们的问题。但是早晚会不支持的(
以及用PostgreSQL跑不起来(

2021-11-24 23:10:29.747 | ERROR    | SAGIRIBOT.Core.AppCore:bot_launch_init:174 - Traceback (most recent call last):
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 420, in _prepare_and_execute
    self._rows = await prepared_stmt.fetch(*parameters)
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/asyncpg/prepared_stmt.py", line 176, in fetch
    data = await self.__bind_execute(args, 0, timeout)
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/asyncpg/prepared_stmt.py", line 241, in __bind_execute
    data, status, _ = await self.__do_execute(
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/asyncpg/prepared_stmt.py", line 230, in __do_execute
    return await executor(protocol)
  File "asyncpg/protocol/protocol.pyx", line 201, in bind_execute
asyncpg.exceptions.UndefinedObjectError: type "blob" does not exist

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1802, in _execute_context
    self.dialect.do_execute(
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 719, in do_execute
    cursor.execute(statement, parameters)
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 457, in execute
    self._adapt_connection.await_(
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 76, in await_only
    return current.driver.switch(awaitable)
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 129, in greenlet_spawn
    value = await result
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 432, in _prepare_and_execute
    self._handle_exception(error)
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 367, in _handle_exception
    self._adapt_connection._handle_exception(error)
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 660, in _handle_exception
    raise translated_error from error
sqlalchemy.dialects.postgresql.asyncpg.AsyncAdapt_asyncpg_dbapi.ProgrammingError: <class 'asyncpg.exceptions.UndefinedObjectError'>: type "blob" does not exist

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/root/QQBot/sagiri-bot/SAGIRIBOT/Core/AppCore.py", line 131, in bot_launch_init
    await orm.create_all()
  File "/root/QQBot/sagiri-bot/SAGIRIBOT/ORM/AsyncORM.py", line 97, in create_all
    await conn.run_sync(self.Base.metadata.create_all)
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/sqlalchemy/ext/asyncio/engine.py", line 536, in run_sync
    return await greenlet_spawn(fn, conn, *arg, **kw)
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 134, in greenlet_spawn
    result = context.throw(*sys.exc_info())
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/sqlalchemy/sql/schema.py", line 4785, in create_all
    bind._run_ddl_visitor(
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 2113, in _run_ddl_visitor
    visitorcallable(self.dialect, self, **kwargs).traverse_single(element)
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/sqlalchemy/sql/visitors.py", line 524, in traverse_single
    return meth(obj, **kw)
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/sqlalchemy/sql/ddl.py", line 846, in visit_metadata
    self.traverse_single(
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/sqlalchemy/sql/visitors.py", line 524, in traverse_single
    return meth(obj, **kw)
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/sqlalchemy/sql/ddl.py", line 890, in visit_table
    self.connection.execute(
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/sqlalchemy/future/engine.py", line 280, in execute
    return self._execute_20(
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1614, in _execute_20
    return meth(self, args_10style, kwargs_10style, execution_options)
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/sqlalchemy/sql/ddl.py", line 77, in _execute_on_connection
    return connection._execute_ddl(
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1381, in _execute_ddl
    ret = self._execute_context(
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1845, in _execute_context
    self._handle_dbapi_exception(
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 2026, in _handle_dbapi_exception
    util.raise_(
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 207, in raise_
    raise exception
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1802, in _execute_context
    self.dialect.do_execute(
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 719, in do_execute
    cursor.execute(statement, parameters)
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 457, in execute
    self._adapt_connection.await_(
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 76, in await_only
    return current.driver.switch(awaitable)
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 129, in greenlet_spawn
    value = await result
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 432, in _prepare_and_execute
    self._handle_exception(error)
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 367, in _handle_exception
    self._adapt_connection._handle_exception(error)
  File "/root/anaconda3/envs/QQBot/lib/python3.8/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 660, in _handle_exception
    raise translated_error from error
sqlalchemy.exc.ProgrammingError: (sqlalchemy.dialects.postgresql.asyncpg.ProgrammingError) <class 'asyncpg.exceptions.UndefinedObjectError'>: type "blob" does not exist
[SQL: 
CREATE TABLE keyword_reply (
        keyword VARCHAR(200) NOT NULL, 
        reply_type VARCHAR(10) NOT NULL, 
        reply BLOB NOT NULL, 
        reply_md5 VARCHAR(32) NOT NULL, 
        PRIMARY KEY (keyword, reply_md5)
)

]
(Background on this error at: https://sqlalche.me/e/14/f405)

呜呜呜,爬取用SQLite了

@Evyde Evyde closed this as completed Nov 24, 2021
@Evyde
Copy link
Author

Evyde commented Nov 24, 2021

mah 1.12.0 可以支持到稳定版的 2.7.1 目前 debian buster x64 + mah 1.12.0 + mirai-* 2.7.1 + python 3.8 没大问题

确实,但这玩意已经更新到2.9.0了。。。版本一旧就容易发不出去图片(

@Evyde Evyde reopened this Nov 25, 2021
@nullqwertyuiop
Copy link

应该不是发不出去图片吧()
tx好喜欢吞图来着

@Evyde
Copy link
Author

Evyde commented Nov 25, 2021

应该不是发不出去图片吧() tx好喜欢吞图来着

大面积问题,2.7.0的问题,升级2.7.1好了,但是总有一天2.7.1也会发不出去图的(

@nullqwertyuiop
Copy link

能苟一天就是一天我现在是(
2.7.1也有很多MiraiEvent已经不能收到了

@Evyde
Copy link
Author

Evyde commented Nov 25, 2021

能苟一天就是一天我现在是( 2.7.1也有很多MiraiEvent已经不能收到了

好吧,部署一次这个机器人挺折磨的(
之前 #3 的时候我就被折磨过一次,这次又折磨了一次,在不远的将来还得折磨一次(
每次的部署方法都不一样。
还有就是不知道为啥用不了PostgreSQL,我用其它程序连接数据库没啥问题。感觉是异步的asyncpg中间件的问题。

@nullqwertyuiop
Copy link

部署完了就快乐了()
目前我已经加了100+个群 140w条记录了()
跑起来了就问题不大了

@Evyde
Copy link
Author

Evyde commented Nov 25, 2021

部署完了就快乐了() 目前我已经加了100+个群 140w条记录了() 跑起来了就问题不大了

确实,虽然我的群不是很多,不过也很快乐。

This was referenced Dec 28, 2021
@SAGIRI-kawaii
Copy link
Owner

fixed

@Evyde
Copy link
Author

Evyde commented Jan 5, 2022

fixed

辛苦Owner了😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants