king-michael / simulation_database

Apache License 2.0
1 stars 1 forks source link

DatabaseViewer: keyerror if there are no keywords in the database #10

Closed king-michael closed 6 years ago

king-michael commented 6 years ago

Problem

if there are no keywords in the database (e.g.micha_raw.db) the Viewer throws a KeyError (see below)

it works if there are keywords in the table keywords (e.g. andrej_raw.db`)

Error

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 2309, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 2295, in wsgi_app
    response = self.handle_exception(e)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1741, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/micha/SIM-PhD-King/simulation_database/simdb/app/views.py", line 35, in list_all
    table = getEntryTable(path)
  File "/home/micha/SIM-PhD-King/simulation_database/simdb/databaseAPI.py", line 77, in getEntryTable
    p = m.pivot(index='id_x', columns='name')["value"]
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 2686, in __getitem__
    return self._getitem_multilevel(key)
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/frame.py", line 2730, in _getitem_multilevel
    loc = self.columns.get_loc(key)
  File "/usr/local/lib/python2.7/dist-packages/pandas/core/indexes/multi.py", line 2242, in get_loc
    raise KeyError(key)
KeyError: 'value'