Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dbm.error: db file doesn't exist; use 'c' or 'n' flag to create a new db #244

Closed
amotl opened this issue Nov 22, 2020 · 1 comment
Closed

Comments

@amotl
Copy link
Member

amotl commented Nov 22, 2020

Describe the bug
After switching back to my regular development environment based on vanilla Python 3.8 from the micromamba environment for researching into #241, Wetterdienst croaks again. Accessing the cache from there already tripped #242.

To reproduce

  1. Follow the installation at Run radar tests including wradlib on GHA #241 (comment).
  2. Run some invocation of Wetterdienst.
  3. Switch back to environment based on vanilla Python.
  4. Run some invocation of Wetterdienst.

Expected behavior
Installing and invoking wetterdienst should just work (TM).

Version information
OS: macOS
Environment: Vanilla Python

$ wetterdienst --version
wetterdienst 0.10.1
$ python -V
Python 3.8.6

Additional context
Dogpile cache based on dbmfile strikes again. See also #217, #232, #233 and #242.

Full traceback

Traceback (most recent call last):
  File "/Users/amo/Library/Caches/pypoetry/virtualenvs/wetterdienst-EkOFQaO8-py3.8/bin/wetterdienst", line 33, in <module>
    sys.exit(load_entry_point('wetterdienst', 'console_scripts', 'wetterdienst')())
  File "/Users/amo/dev/earthobservations/wetterdienst/wetterdienst/cli.py", line 234, in run
    df = get_nearby(options)
  File "/Users/amo/dev/earthobservations/wetterdienst/wetterdienst/cli.py", line 341, in get_nearby
    nearby_stations = DWDObservationSites(
  File "/Users/amo/dev/earthobservations/wetterdienst/wetterdienst/core/sites.py", line 154, in nearby_radius
    metadata = self.all()
  File "/Users/amo/dev/earthobservations/wetterdienst/wetterdienst/core/sites.py", line 51, in all
    metadata = self._all()
  File "/Users/amo/dev/earthobservations/wetterdienst/wetterdienst/dwd/observations/api.py", line 422, in _all
    metadata = metadata_for_climate_observations(
  File "/Users/amo/dev/earthobservations/wetterdienst/wetterdienst/dwd/observations/stations.py", line 43, in metadata_for_climate_observations
    meta_index = create_meta_index_for_climate_observations(
  File "<decorator-gen-3>", line 2, in create_meta_index_for_climate_observations
  File "/Users/amo/Library/Caches/pypoetry/virtualenvs/wetterdienst-EkOFQaO8-py3.8/lib/python3.8/site-packages/dogpile/cache/region.py", line 1356, in get_or_create_for_user_func
    return self.get_or_create(
  File "/Users/amo/Library/Caches/pypoetry/virtualenvs/wetterdienst-EkOFQaO8-py3.8/lib/python3.8/site-packages/dogpile/cache/region.py", line 954, in get_or_create
    with Lock(
  File "/Users/amo/Library/Caches/pypoetry/virtualenvs/wetterdienst-EkOFQaO8-py3.8/lib/python3.8/site-packages/dogpile/lock.py", line 185, in __enter__
    return self._enter()
  File "/Users/amo/Library/Caches/pypoetry/virtualenvs/wetterdienst-EkOFQaO8-py3.8/lib/python3.8/site-packages/dogpile/lock.py", line 87, in _enter
    value = value_fn()
  File "/Users/amo/Library/Caches/pypoetry/virtualenvs/wetterdienst-EkOFQaO8-py3.8/lib/python3.8/site-packages/dogpile/cache/region.py", line 899, in get_value
    value = self.backend.get(key)
  File "/Users/amo/Library/Caches/pypoetry/virtualenvs/wetterdienst-EkOFQaO8-py3.8/lib/python3.8/site-packages/dogpile/cache/backends/file.py", line 221, in get
    with self._dbm_file(False) as dbm:
  File "/Users/amo/.pyenv/versions/3.8.5/lib/python3.8/contextlib.py", line 113, in __enter__
    return next(self.gen)
  File "/Users/amo/Library/Caches/pypoetry/virtualenvs/wetterdienst-EkOFQaO8-py3.8/lib/python3.8/site-packages/dogpile/cache/backends/file.py", line 216, in _dbm_file
    dbm = self.dbmmodule.open(self.filename, "w" if write else "r")
  File "/Users/amo/.pyenv/versions/3.8.5/lib/python3.8/dbm/__init__.py", line 85, in open
    raise error[0]("db file doesn't exist; "
dbm.error: db file doesn't exist; use 'c' or 'n' flag to create a new db
@amotl
Copy link
Member Author

amotl commented Nov 22, 2020

Like with similar errors of this kind, this issue can be resolved by purging the cache directory, like rm -r ~/Library/Caches/wetterdienst.

@amotl amotl closed this as completed Nov 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant