python - shutil.rmtree 可以抛出的异常的完整列表是什么

标签 python shutil

我在 Python (2.7) 中使用 shutil 的 rmtree 方法。

调用此方法时可能发生的所有异常是什么?

最佳答案

根据实现,您必须检查OSError。 但是您可以在调用时使用参数 ignore_errors=True 来...忽略错误 ;) 或提供回调 onerror 以在执行文件删除期间检查异常。 ( cf shutil.rmtree documentation )

关于python - shutil.rmtree 可以抛出的异常的完整列表是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5962152/

相关文章:

python - 如何将文件文件夹移动到可变命名的文件夹

python - 使用shutil.copyfile复制受限文件,无需成为Python的root用户

用os模块覆盖python文件

python - PRAW 不理解之后的关键字参数

python - 命名元组与字典

python - 如何使用 Python 获取 Accordion block 中隐藏的 div 的内容?

python (openpyxl) : Put data from one excel file to another (template file) & save it with another name while retaining the template

python - shutil.rmtree 不适用于 Windows 库

python - 当我运行解释语言二进制文件及其脚本时,如何检查链接了哪些共享库?

python - PyGTK:制作一个行为类似于 OpenOffice 的 TextView