gpt4 book ai didi

Python sqlite3 在本地成功,但在 Github Action 上失败

转载 作者:行者123 更新时间:2023-12-05 02:06:01 32 4
gpt4 key购买 nike

相同的 python 版本,相同的 sqlite3 版本,相同的文件,但我就是无法通过 Github Action。

这是我的 github 操作: https://github.com/CloudAurora/Blog/blob/master/.github/workflows/main.yml

和我的 python 文件:https://github.com/CloudAurora/Blog/blob/master/scripts/init_database.py

我可以在我的本地 linux 机器上成功运行这个文件:

Projects/Blog - [master●] » python scripts/init_database.py -r ./posts --token  xxx
sqlite version 2.6.0
INSERT_USER_STATEMENT
INSERT INTO User(bio, email, githubId, name)
VALUES(?,?,?,?)
ON CONFLICT(name) DO NOTHING

INSERT_USER_STATEMENT
INSERT INTO User(bio, email, githubId, name)
VALUES(?,?,?,?)
ON CONFLICT(name) DO NOTHING

Create db file in: ./prisma/dev.db, and env is set

但是,当我将它推送到 github 时,它会在 Github Action 中失败:

 sqlite version 2.6.0
INSERT_USER_STATEMENT
INSERT INTO User(bio, email, githubId, name)
VALUES(?,?,?,?)
ON CONFLICT(name) DO NOTHING

Traceback (most recent call last):
File "scripts/init_database.py", line 110, in <module>
c.execute(INSERT_USER_STATEMENT, author_info)
sqlite3.OperationalError: near "ON": syntax error
##[error]Process completed with exit code 1.

您可以找到完整的日志:https://github.com/CloudAurora/Blog/runs/899163805?check_suite_focus=true

最佳答案

在我的 YAML 工作流中为我解决了一个类似的 SQLite 问题,替换

runs-on: ubuntu-latest 

runs-on: ubuntu-20.04

ubuntu-latest 使用的是 Ubuntu 18.04 并且 SQLite 版本似乎很旧并且有问题。

关于Python sqlite3 在本地成功,但在 Github Action 上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63034846/

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