小编Ego*_*gon的帖子

sqlite3.OperationalError: table book 有 6 列,但提供了 5 个值

得到一个错误:

Traceback (most recent call last):
  File "frontend.py", line 2, in <module>
    import backend
  File "/Users/egonsaks/Desktop/Demo/backend.py", line 28, in <module>
    insert("The sea", "John Tablet", 1918, 987654331)
  File "/Users/egonsaks/Desktop/Demo/backend.py", line 15, in insert
    cur.execute("INSERT INTO book VALUES (NULL,?,?,?,?)",(title, author, year, isbn))
  sqlite3.OperationalError: table book has 6 columns but 5 values were supplied
Run Code Online (Sandbox Code Playgroud)

在数据库的表中插入数据时,我想要带有主键整数的 id 列。我根据教程检查了我的代码,并在堆栈溢出中四处寻找类似问题的解决方案,但没有找到解决方案。测试了一些东西,比如删除一个空值,但它说提供了 6 列和 4 个值。

代码在这里:

import sqlite3

def connect():
    conn = sqlite3.connect("books.db")
    cur = conn.cursor()
    cur.execute("CREATE TABLE IF NOT EXISTS book (id INTEGER PRIMARY KEY, 
    title …
Run Code Online (Sandbox Code Playgroud)

python sqlite

4
推荐指数
1
解决办法
1万
查看次数

Docker 运行错误:exec /app/backend/server:没有这样的文件或目录

我在尝试运行 Docker 容器时遇到问题。我从 Dockerfile 构建图像:

docker build -t server -f ./backend/Dockerfile .   
Run Code Online (Sandbox Code Playgroud)

运行:

docker run -it -p 8081:8081 server
Run Code Online (Sandbox Code Playgroud)

出现错误:

exec /app/backend/server: no such file or directory
Run Code Online (Sandbox Code Playgroud)

当我从 Docker Desktop 进行检查时,我会在容器内看到该文件存在,并且已按其应有的位置创建到该位置。

我还尝试从 golang:1.21-alpine更改第二阶段,但仍然遇到相同的错误。

通过FROM gcr.io/distroless/base-debian11我得到:

/app/backend/server: /lib/aarch64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /app/backend/server)
/app/backend/server: /lib/aarch64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /app/backend/server)
/app/backend/server: /lib/aarch64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /app/backend/server)
Run Code Online (Sandbox Code Playgroud)

我看了这里这里并尝试了很多东西。我对 Docker 比较陌生,不知道如何解决这个问题。有人可以帮助我了解可能导致此错误的原因以及如何解决它吗?提前致谢!

我的 Dockerfile 如下:

# Stage 1: Building the …
Run Code Online (Sandbox Code Playgroud)

linux go docker

3
推荐指数
1
解决办法
907
查看次数

在 python 中使用 cv2.findContours() 时出现 ValueError。-&gt; 没有足够的值来解包(预期为 3,得到 2)

得到一个错误:

Traceback (most recent call last):
    File "motion_detector.py", line 21, in <module>
        (_, cnts, _) = cv2.findContours(thresh_frame.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) 
ValueError: not enough values to unpack (expected 3, got 2)
Run Code Online (Sandbox Code Playgroud)

在检测图像中的轮廓时遇到问题。已经从教程中仔细检查并从堆栈溢出中查看以了解我遗漏了什么,但找不到解决方案。使用 Python 3.6.4 和 OpenCV 4.0.0。谢谢您的帮助!

代码在这里:

import cv2, time

first_frame = None

video = cv2.VideoCapture(0)

while True:
    check, frame = video.read()

    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    gray = cv2.GaussianBlur(gray,(21,21),0) 

    if first_frame is None:
        first_frame = gray 

    delta_frame = cv2.absdiff(first_frame, gray)
    thresh_frame = cv2.threshold(delta_frame, 30, 255, cv2.THRESH_BINARY)[1]
    thresh_frame = cv2.dilate(thresh_frame, None, iterations …
Run Code Online (Sandbox Code Playgroud)

python opencv python-3.x

2
推荐指数
1
解决办法
6974
查看次数

标签 统计

python ×2

docker ×1

go ×1

linux ×1

opencv ×1

python-3.x ×1

sqlite ×1