pyknow icon indicating copy to clipboard operation
pyknow copied to clipboard

watch() raises KeyError

Open Henddher opened this issue 6 years ago • 2 comments

STEPS TO REPRODUCE:

Using https://github.com/buguroo/pyknow/blob/develop/docs/examples/maximum.ipynb

watch(watchers.RULES, watchers.FACTS, watchers.ACTIVATIONS)
m.run()
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-4-b1cd45e85340> in <module>
----> 1 watch(watchers.RULES, watchers.FACTS, watchers.ACTIVATIONS)
      2 m.run()

~/Documents/github/pyknow/pyknow/pyknow/watchers.py in watch(level, *what)
     39 
     40     for watcher_name in what:
---> 41         watcher = globals()[watcher_name]
     42         watcher.setLevel(level)
     43 

KeyError: <Logger pyknow.watchers.RULES (WARNING)>

Henddher avatar Dec 31 '18 17:12 Henddher

The comment in that notebook is wrong. Sorry about that.

watch receives strings with the names of the loggers to watch. Please, try:

watch('RULES', 'FACTS', 'ACTIVATIONS')

nilp0inter avatar Dec 31 '18 18:12 nilp0inter

Thanks @nilp0inter

That worked 👍

Feel free to close this issue.

Henddher avatar Dec 31 '18 22:12 Henddher