本文主要是介绍【Mac系统M1芯片 NotADirectoryError: [Errno 20] .DS_Store Not a directory:亲测有效的解决方法】,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
Mac系统M1芯片 NotADirectoryError: [Errno 20] .DS_Store Not a directory:亲测有效的解决方法
-
问题:
NotADirectoryError: [Errno 20] .DS_Store Not a directory
-
解决方法_1
– 网上很多种解决方案都是下述指令:find . -name "*.DS_Store" -type f -delete ### 删掉文件夹所有的.DS_Store文件 defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool TRUE ###禁止.DS_store生成,打开 “终端” ,执行这条命令,重启Mac即可生效 defaults delete com.apple.desktopservices DSDontWriteNetworkStores ## 如果需要恢复.DS_store生成,在终端运行这条指令
上述三条指令,在Mac M1芯片的系统中尝试过还是继续报错,没有解决,也有可能是我的配置还存在其他问题?
-
解决方法_2:
– 在上述方法行不通的情况下,仔细查看自己的代码,发现问题的根源在于,读取文件夹中的图像中,会默认读取到一个名为.DS_Store的隐藏文件,删又删不掉,索性加一个if判断,如果读取到名为.DS_Store时,直接pass,其他模块正常运行。有点类似于try…except的思路。if filename ==".DS_Store":pass else:原始脚本
这篇关于【Mac系统M1芯片 NotADirectoryError: [Errno 20] .DS_Store Not a directory:亲测有效的解决方法】的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!