Skip to content

Commit 4b8b5cb

Browse files
committed
fix rmdir
1 parent 67f4027 commit 4b8b5cb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

dpdispatcher/dp_cloud_server_context.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,9 @@ def _backup(self, local_root, target, keep_backup=True):
180180

181181
def _clean_backup(self, local_root, keep_backup=True):
182182
if not keep_backup:
183-
os.removedirs(os.path.join(local_root, 'backup'))
183+
dir_to_be_removed = os.path.join(local_root, 'backup')
184+
if os.path.exists(dir_to_be_removed):
185+
shutil.rmtree(dir_to_be_removed)
184186

185187
def write_file(self, fname, write_str):
186188
result = self.write_home_file(fname, write_str)

0 commit comments

Comments
 (0)