probcomp / iventure

An interactive, browser-based probabilistic programming environment.
Apache License 2.0
14 stars 2 forks source link

confusing error message from %bql without %bayesdb #30

Open riastradh-probcomp opened 7 years ago

riastradh-probcomp commented 7 years ago
/usr/lib/python2.7/dist-packages/iventure/magics.pyc in _bql(self, lines)
    339             if out.getvalue() and bql_string_complete_p(out.getvalue()):
    340                 ok = True
--> 341         cursor = self._bdb.execute(out.getvalue())
    342         return utils_bql.cursor_to_df(cursor)
    343 

AttributeError: 'NoneType' object has no attribute 'execute'
riastradh-probcomp commented 7 years ago

Two obvious possible resolutions:

  1. Always open a bdb, using an in-memory one by default. Upside: no 'bdb not open' state. Downside: default will discard data when you restart notebook.
  2. Change self._bdb to be a method (or property) that fails with a more legible error message if you haven't done %bayesdb, telling you to do that. Upside: default will refuse to handle data rather than quietly discard it when you restart notebook. Downside: two states to worry about.