Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
697 views
in Technique[技术] by (71.8m points)

python-3.x - sqlite3无法打开数据库(sqlite3 unable to open database)

I am trying to write data on a database located on an external hard drive on macos.

(我正在尝试在macOS上的外部硬盘驱动器上的数据库中写入数据。)

As far as I can know, the sq3.Connection statement will test whether the database exists or not (and if not will create it)

(据我所知,sq3.Connection语句将测试数据库是否存在(如果不存在,则将创建数据库))

When running the following

(运行以下内容时)

import sqlite3 as sq3
con = sq3.Connection('/Volumes/AGCM/MyDatabase.db')

I get the following error:

(我收到以下错误:)

sqlite3.OperationalError: unable to open database file

I have checked the permissions and I have read&write access on this drive.

(我已经检查了权限,并且对该驱动器具有读写访问权限。)

One thing to note is that this was working fine until my old imac died and had to replace it with a macbook pro.

(需要注意的一件事是,在我以前的imac死掉并不得不用macbook pro代替它之前,它一直工作良好。)

I am using python 3.8 on this laptop.

(我在这台笔记本电脑上使用python 3.8。)

I have databases on this hard drive and I can access and modify them via "DB Browser for SQLite"

(我在此硬盘驱动器上有数据库,可以通过“ DB Browser for SQLite”访问和修改它们)

Edit: it does work on the local directory

(编辑:它确实在本地目录上工作)

  ask by Hotone translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...