1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 【Anaconda】FileNotFoundError: [Errno 2] No such file or directory:

【Anaconda】FileNotFoundError: [Errno 2] No such file or directory:

时间:2019-09-01 10:00:03

相关推荐

【Anaconda】FileNotFoundError: [Errno 2] No such file or directory:

Q:文件能正常读取和处理,在保存时出现报错如下

FileNotFoundError: [Errno 2] No such file or directory: '/home/(不重要的路径)/test/00001/augmented1.wav'

路径='savepath'/'file'

相关代码:

for file in files:dataname = path + filesavename = savepath + fileif "augmented" in dataname:shutil.move(dataname, savename)

path='/home/(不重要的路径)/test/00001/' files= os.listdir(path) savepath='/home/(不重要的路径)/test/00001/'

A:savepath只能是已经存在的路径,在相应的位置新建文件夹后该报错消失(我是猪比吗?)

TIP2:使用path+file的组合方式的时候记得path的最后一级文件夹后面要加"/",不然也会报错,因为你的dataname会变成

'/home/(不重要的路径)/train/00001filename'#即train文件夹下的00001file

而不是

'/home/(不重要的路径)/train/00001/filename'#train文件夹下的00001子文件夹中的file

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。