Commit d10f56dd by Calen Pennington

Only try to remove a directory if it exists during import

parent fb48a4fb
......@@ -895,7 +895,8 @@ def import_course(request, org, course, name):
course_dir = filename.replace('.tar.gz', '')
tf = tarfile.open(temp_filepath)
shutil.rmtree(data_root / course_dir)
if (data_root / course_dir).isdir():
shutil.rmtree(data_root / course_dir)
tf.extractall(data_root + '/')
os.remove(temp_filepath) # remove the .tar.gz file
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment