AttributeError: 'NoneType' object has no attribute 'connect'

AttributeError: 'NoneType' object has no attribute 'connect'

我 运行ning Trac 1.2.2 在 Python 2.7 上,MariaDB 在 Ubuntu 18.04 上,我现在必须移动到 Ubuntu 20.04。我知道 Python 2.7 不再受支持,但我仍然需要 运行 在我的 Ubuntu 20.04 服务器上使用它,因为我正在 运行 使用旧版本的 Trac我现在无法升级,因为插件在最新版本中不起作用...

所以我迁移了 MariaDB 数据库,在 this comment 的帮助下通过 pip 安装 MySQL-python,现在我在 Trac 的调试模式下遇到以下错误:

2021-03-18 10:16:31,836 Trac[main] ERROR: can't retrieve session: TimeoutError: Unable to get database connection within 0 seconds. (AttributeError: 'NoneType' object has no attribute 'connect')

知道我可能错过了什么吗?

我自己解决了这个问题。来自 this comment 的文件在 Ubuntu 20.04

下无法正常工作

我将文件 my_config.h 从 Ubuntu 18.04 安装复制到我的 Ubuntu 20.04 到 /usr/include/mysql 然后 pip install MySQL-python 再次,现在一切正常:-)