mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-24 12:05:22 +08:00
Use os.remove instead of shutil.rmtree if we try to remove a symbolic link
If we try to remove a symbolic link to a directory with shutil.rmtree, we get the error “Cannot call rmtree on a symbolic link”
This commit is contained in:
parent
2414db41e6
commit
5a39c0c9bd
@ -149,7 +149,7 @@ def install_nbextension(files, overwrite=False, symlink=False, ipython_dir=None,
|
||||
if overwrite and os.path.exists(dest):
|
||||
if verbose >= 1:
|
||||
print("removing %s" % dest)
|
||||
if os.path.isdir(dest):
|
||||
if os.path.isdir(dest) and not os.path.islink(dest):
|
||||
shutil.rmtree(dest)
|
||||
else:
|
||||
os.remove(dest)
|
||||
|
Loading…
Reference in New Issue
Block a user