Skip to main content
`Ctrl`+`K`

# clear_download_cache

astropy.utils.data.clear_download_cache(hashorurl=None, pkgname='astropy', *, on_missing='warn')

  Clears the data file cache by deleting the local file(s).

  If a URL is provided, it will be the name used in the cache. The contents may have been downloaded from this URL or from a mirror or they may have been provided by the user. See `download_file` for details.

  For the purposes of this function, a file can also be identified by a hash of its contents or by the filename under which the data is stored (as returned by `download_file`, for example).

  Parameters:
    hashorurl `python:str` or `python:None`

      If None, the whole cache is cleared. Otherwise, specify a hash for the cached file that is supposed to be deleted, the full path to a file in the cache that should be deleted, or a URL that should be removed from the cache if present.

    pkgname `str`, optional

      The package name to use to locate the download cache. i.e. for `pkgname='astropy'` the default cache location is `~/.cache/astropy`.

    on_missing‘ignore’, ‘warn’, or ‘error’

      What to do if the path requested for deletion doesn’t exist. Default: ‘warn’

      Added in version 8.0.