我正在尝试从一个文件夹中读取多个图像并将其复制到另一个文件夹。我可以选择多个图像,但当我按下文件打开按钮时,会出现上述错误
import shutil,os,glob
from tkinter import filedialog
from tkinter import *
from tkinter.filedialog import askopenfilenames
def callback():
src = askopenfilenames()
des = r"C:\Users\tkumar\.spyder-py3\there"
sourceFiles = os.listdir(src) #error is here i think.
#print(len(sourceFiles))
#shutil.copy(src, des)
try:
for fileName in sourceFiles:
fullName = os.path.join(src, fileName)
if (os.path.isfile(fullName)):
shutil.copy(fullName, des)
except Exception as e:
print("Error %s" %e)
errmsg = 'Error!'
Button(text='File Open', command=callback).pack(fill=X)
mainloop()
相关问题 更多 >
编程相关推荐