I've run into an issue in using the knowledge engine to try and prove
non-existing facts from the database. This fails with an exception
such as the following:
Traceback (most recent call last):
File "test.py", line 7, in <module>
print engine.prove_1("test", "nonexistent", (), 1)
knowledge_engine.py", line 207, in prove_1
knowledge_engine.py", line 189, in gen
AttributeError: 'tuple' object has no attribute '__exit__'
Otherwise this would be not be such a huge issue, but the same problem
seems to make it impossible to define BC rules that reference facts
which may or may not be in the database. For example:
# commented out
from pyke import knowledge_engine
engine = knowledge_engine.engine()
engine.prove_1("test_rules", "foo", (), 1)
This test works when bar(123) is uncommented in the database, but
otherwise it fails with the same exception as shown above. I would
expect prove_1 to instead fail with CanNotProve.
Log in to post a comment.