diff --git a/src/sage_docbuild/__init__.py b/src/sage_docbuild/__init__.py index 9160119baa1..3a8a2ad5ed7 100644 --- a/src/sage_docbuild/__init__.py +++ b/src/sage_docbuild/__init__.py @@ -810,9 +810,12 @@ def save_cache(self): Pickle the current reference cache for later retrieval. """ cache = self.get_cache() - with open(self.cache_filename(), 'wb') as file: - pickle.dump(cache, file) - logger.debug("Saved the reference cache: %s", self.cache_filename()) + try: + with open(self.cache_filename(), 'wb') as file: + pickle.dump(cache, file) + logger.debug("Saved the reference cache: %s", self.cache_filename()) + except PermissionError: + logger.debug("Permission denied for the reference cache: %s", self.cache_filename()) def get_sphinx_environment(self): """