I am using the rmtree method from shutil in Python (2.7).
What are all possible exceptions that can occur while calling this method?
I am using the rmtree method from shutil in Python (2.7).
What are all possible exceptions that can occur while calling this method?
According to the implementation, you'll have to check OSError
.
But you can use the argument ignore_errors=True
on call to...ignore errors ;) or give a callback onerror
that will check the exceptions during the execution of file removal. (cf shutil.rmtree documentation)
Unless you do something very funky, os.error
and OSError
rmtree
tries to catch both, in different places. Maybe it's some kind of a historic artifact –
Downcomer © 2022 - 2024 — McMap. All rights reserved.