Must call os.remove on files

This commit is contained in:
Thomas Nagy 2016-05-21 01:15:19 +02:00
parent a079b50df1
commit f876392200
No known key found for this signature in database
GPG Key ID: 67A565EDFDF90E64
1 changed files with 4 additions and 1 deletions

View File

@ -215,7 +215,10 @@ class Node(object):
"""Delete the file/folder, and remove this node from the tree. Do not use this object after calling this method."""
try:
try:
shutil.rmtree(self.abspath())
if os.path.isdir(self.abspath()):
shutil.rmtree(self.abspath())
else:
os.remove(self.abspath())
except OSError as e:
if os.path.exists(self.abspath()):
raise e