c-w / gutenberg

A simple interface to the Project Gutenberg corpus.
Apache License 2.0
322 stars 60 forks source link

Cannot populate cache #142

Closed DigiDr closed 3 years ago

DigiDr commented 3 years ago

Hi,

Pulled the latest version - am attempting to populate the cache without success:

Traceback (most recent call last):
  File "/home/digidr/swarm-tools/books.py", line 5, in <module>
    cache.populate()
  File "/home/digidr/swarm_venv/lib/python3.8/site-packages/gutenberg/acquire/metadata.py", line 97, in populate
    for fact in self._iter_metadata_triples(metadata_archive):
  File "/home/digidr/swarm_venv/lib/python3.8/site-packages/gutenberg/acquire/metadata.py", line 165, in _iter_metadata_triples
    with closing(tarfile.open(metadata_archive_path)) as metadata_archive:
  File "/usr/lib/python3.8/tarfile.py", line 1606, in open
    raise ReadError("file could not be opened successfully")
tarfile.ReadError: file could not be opened successfully

Using:

from gutenberg.acquire import set_metadata_cache
from gutenberg.acquire.metadata import SleepycatMetadataCache

cache = SleepycatMetadataCache('/home/digidr/gutenberg/metadata.db')
cache.populate()
set_metadata_cache(cache)
DigiDr commented 3 years ago

Fixed - my host was blocking the url!