def symlink_remove ( link ) : # https://stackoverflow.com/q/26554135/6400719 if os . path . isdir ( path2str ( link ) ) and is_windows : # this should only be on Py2.7 and windows os . rmdir ( path2str ( link ) ) else : os . unlink ( path2str ( link ) )
how to remove symlink in python
Remove a symlink . Used for model shortcut links .
def symlink_remove(link):
    """Remove a symlink. Used for model shortcut links.

    link (unicode / Path): The path to the symlink.
    """
    # https://stackoverflow.com/q/26554135/6400719
    if os.path.isdir(path2str(link)) and is_windows:
        # this should only be on Py2.7 and windows
        os.rmdir(path2str(link))
    else:
        os.unlink(path2str(link))