我正在尝试将文件保存到特定目录。该文件最终保存到指定目录,但是当我打开文件时,它告诉我该文件为空。
import os
from os.path import join as pjoin
images = system.file.openFiles()
#os.chdir('O:\TestImages')
new_dir = 'O:\TestImages'
for image in images:
system.file.readFileAsBytes(image)
image_name = os.path.basename(image)
saved_path = pjoin(new_dir,image_name)
open(saved_path, "w")
print(saved_path)
system.db.runPrepUpdate("INSERT INTO ImageManagement (ImageName) VALUES (?)", [image_name])