Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

[495079]: examples / findall / run.py Maximize Restore History

Download this file

run.py    30 lines (24 with data), 674 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# run.py
from __future__ import with_statement
import sys
from pyke import knowledge_engine
from pyke import krb_traceback
engine = knowledge_engine.engine(__file__)
def fc_test():
engine.reset()
try:
engine.activate('fc_findall')
except:
krb_traceback.print_exc()
sys.exit(1)
def bc_test():
engine.reset()
try:
engine.activate('bc_findall')
with engine.prove_goal('bc_findall.cousins_of($child, $cousins)') \
as gen:
for vars, plan in gen:
print "%s has %s as cousins" % (vars['child'], vars['cousins'])
except:
krb_traceback.print_exc()
sys.exit(1)