Incomprehensible error with `make_searchable` on new database

Create issue
Issue #30 resolved
Chris Mutel repo owner created an issue

Current error is e.g.

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-30-8e5992c4fb52> in <module>()
      1 db = Database("biosphere2")
----> 2 db.make_searchable()

/Users/cmutel/local35/bw3/lib/python3.5/site-packages/bw2data/project.py in writable_project(wrapped, instance, args, kwargs)
    298     if projects.read_only:
    299         raise ReadOnlyProject(READ_ONLY_PROJECT)
--> 300     return wrapped(*args, **kwargs)

/Users/cmutel/local35/bw3/lib/python3.5/site-packages/bw2data/backends/peewee/database.py in make_searchable(self)
    276             print("This database is already searchable")
    277             return
--> 278         databases[self.name]['searchable'] = True
    279         databases.flush()
    280         IndexManager(self.filename).add_datasets(self)

/Users/cmutel/local35/bw3/lib/python3.5/site-packages/bw2data/serialization.py in __getitem__(self, key)
    140         if isinstance(key, list):
    141             key = tuple(key)
--> 142         return self.data[key]
    143 
    144     @writable_project

KeyError: 'biosphere2'

This should be clearer that the database doesn't exist, therefore can't be made searchable.

Comments (1)

  1. Log in to comment