gpt4 book ai didi

Python 多处理 : AttributeError: Can't pickle local object

转载 作者:行者123 更新时间:2023-12-04 16:44:59 34 4
gpt4 key购买 nike

我使用 this framework 为协作工具 Mattermost 编写了一个 ChatOps 机器人.现在我正在尝试编写和运行集成测试,我使用了他们的 examples .通过克隆 git 存储库,您可以自己运行测试。他们的 docker-compose.yml文件只能在 Linux 机器上工作。如果你想在 Mac 机器上重现它,你必须编辑 docker-compose.yml到:

version: "3.7"

services:
app:
container_name: "mattermost-bot-test"
build: .
command: ./mm/docker-entry.sh
ports:
- "8065:8065"
extra_hosts:
- "dockerhost:127.0.0.1"
运行命令后 docker-compose up -d Mattermost 可在 localhost:8065 获得.我只从他们的项目中进行了一个简单的测试,并将其复制到 base-test.py .你可以看我的源代码 here .通过运行命令开始测试后 pytest --capture=no --log-cli-level=DEBUG .它将返回以下错误: AttributeError: Can't pickle local object 'start_bot.<locals>.run_bot' .这个错误也出现在他们项目的同一个测试用例中。错误发生在 utils.py 的第 92 行 file
我在这里做错了什么?

最佳答案

我不知道你是否已经走上了这条路,但我认为你可以通过让 run_bot 使用它所做的机器人来克服酸洗错误 bot.run() with 作为参数,然后将其传递给进程。

关于Python 多处理 : AttributeError: Can't pickle local object,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70085083/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com