def remove_path(path):
    """remove path from file system
    If path is None - do nothing"""
    if path is None or not os.path.exists(path):
        return
    if platform.system() == 'Windows':
        # Need to have write permission before deleting the file.
        os.chmod(path, stat.S_IWRITE)
    try:
        if os.path.isdir(path):
            shutil.rmtree(path)
        elif os.path.isfile(path):
            shutil.os.remove(path)
    except OSError:
        logger.exception("Could not remove path: %s" % path)
def remove_path ( path ) : if path is None or not os . path . exists ( path ) : return if platform . system ( ) == 'Windows' : os . chmod ( path , stat . S_IWRITE ) try : if os . path . isdir ( path ) : shutil . rmtree ( path ) elif os . path . isfile ( path ) : shutil . os . remove ( path ) except OSError : logger . exception ( "Could not remove path: %s" % path )
remove path from file system
    If path is None - do nothing