Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a complete list of Exceptions that can be thrown by shutil.rmtree

Tags:

python

shutil

I am using the rmtree method from shutil in Python (2.7).

What are all possible exceptions that can occur while calling this method?

like image 831
Peter Smit Avatar asked May 11 '11 09:05

Peter Smit


2 Answers

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)

like image 84
Cédric Julien Avatar answered Nov 12 '22 09:11

Cédric Julien


Unless you do something very funky, os.error and OSError

like image 3
Eli Bendersky Avatar answered Nov 12 '22 08:11

Eli Bendersky