gpt4 book ai didi

Python 错误 : sqlite3. OperationalError:没有这样的表:配置

转载 作者:行者123 更新时间:2023-12-04 18:51:16 26 4
gpt4 key购买 nike

我需要通过命令行更改下拉框默认文件夹(因为我需要在本地网络中的另一台机器上执行此操作,所以我将通过本地机器上的协议(protocol) ssh 访问这台机器)到另一个文件夹,我在互联网上搜索,我找到的所有解决方案都是一样的,使用这个 python 脚本:

> #!/usr/bin/env  
> # Script for showing or setting the dropbox folder.
> #
> # Execute without options to show current dropbox folder (if non-default).
> # Execute with --setfolder=/foo/bar to set new dropbox folder.
> #
> # I dedicate this work to the public domain by waiving all my rights to the
> # work worldwide under copyright law, including all related and neighboring
> # rights, to the extent allowed by law.
> #
> # You can copy, modify, distribute and perform the work, even for commercial
> # purposes, all without asking permission.
> #
> # Wim Coenen (wcoenen@gmail.com).

import base64
import optparse
import os
import os.path
import sqlite3

# parse command line options
cmdparser = optparse.OptionParser()
cmdparser.add_option("-s","--setfolder", dest="folder",
help="set dropbox folder")
(options, args) = cmdparser.parse_args()

db_path = os.path.expanduser("~/.dropbox/dropbox.db")
db = sqlite3.connect(db_path)
cursor = db.cursor()

# get dropbox_path
cursor.execute("select value from config where key='dropbox_path'")
dropbox_path = "<default>"
for entry in cursor:
dropbox_path_base64 = entry[0]
dropbox_path_raw = base64.decodestring(dropbox_path_base64)
dropbox_path = dropbox_path_raw[1:-5]
print "current dropbox path: %s" % dropbox_path

if not options.folder is None:
new_path_raw = "V" + os.path.abspath(options.folder) + "\np1\n."
new_path_base64 = base64.encodestring(new_path_raw)
cursor.execute("delete from config where key='dropbox_path'")
cursor.execute("insert into config (key,value) values (?,?)", \
("dropbox_path", new_path_base64))
db.commit()
print "new dropbox path: %s" % options.folder

db.close()
这是我遵循的教程链接: https://whatbox.ca/wiki/Dropbox
所以,当我尝试执行这个脚本时,我是 python 的新手
python ~/Downloads/dropboxdir.py --setfolder=/home/user/new_folder
他返回了这个错误:

cursor.execute("select value from config where key='dropbox_path'")

sqlite3.OperationalError: no such table: config


所以伙计们,我需要一盏灯,欢迎任何帮助。

最佳答案

数据库是非开源软件的内部部分。我假设 Dropbox 的开发人员已经改变了数据库的结构。

在我的情况下,在 OSX 上使用 dropbox 版本 v16.4.30,dropbox.db 文件甚至不存在,因此他们对其进行了更多更改

关于Python 错误 : sqlite3. OperationalError:没有这样的表:配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41427560/

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