我对PYKE非常新,我从github安装了PYKE。
我正在尝试运行一段代码,我遇到了错误。
文件和底层代码如下:
1> fc_example.krb
direct_father_son
foreach
family.son_of($son, $father)
assert
family.father_son($father, $son, ())
2> family.kfb
son_of(david, bruce)
son_of(bruce, thomas)
son_of(thomas, frederik)
son_of(frederik, hiram)
father_son(bruce, david, ())
father_son(thomas, bruce, ())
father_son(frederik, thomas, ())
father_son(hiram, frederik, ())
3> main.py
from __future__ import with_statement
import contextlib
import sys
import time
from pyke import knowledge_engine, krb_traceback, goal
engine = None
if engine is None:
engine = knowledge_engine.engine(__file__)
当我运行main.py文件时,出现以下错误:
writing [compiled_krb]/family.fbc
Traceback (most recent call last):
File "/home/sam/Desktop/PYKE/main.py", line 13, in <module>
engine = knowledge_engine.engine(__file__)
File "/home/sam/anaconda/lib/python2.7/site-packages/pyke/knowledge_engine.py", line 107, in __init__
target_package.compile(self)
File "/home/sam/anaconda/lib/python2.7/site-packages/pyke/pyke/target_pkg.py", line 288, in compile
source_filename))
File "/home/sam/anaconda/lib/python2.7/site-packages/pyke/pyke/target_pkg.py", line 264, in do_by_ext
return getattr(self, "%s_%s" % (prefix, ext))(filename, *args)
File "/home/sam/anaconda/lib/python2.7/site-packages/pyke/pyke/target_pkg.py", line 298, in compile_krb
self.directory, source_filename)
File "/home/sam/anaconda/lib/python2.7/site-packages/pyke/krb_compiler/__init__.py", line 122, in compile_krb
(generated_root_pkg, rb_name, ast), 3)
File "/home/sam/anaconda/lib/python2.7/site-packages/pyke/knowledge_engine.py", line 411, in prove_1
return iter(it).next()
File "/home/sam/anaconda/lib/python2.7/site-packages/pyke/knowledge_engine.py", line 392, in gen
for plan in it:
File "/home/sam/anaconda/lib/python2.7/site-packages/pyke/pyke/rule_base.py", line 50, in next
return self.iterator.next()
File "/home/sam/anaconda/lib/python2.7/site-packages/pyke/pyke/knowledge_engine.py", line 41, in from_iterable
for x in iterable: yield x
File "/home/sam/anaconda/lib/python2.7/site-packages/pyke/pyke/knowledge_engine.py", line 41, in from_iterable
for x in iterable: yield x
File "/home/sam/anaconda/lib/python2.7/site-packages/pyke/krb_compiler/compiler_bc.py", line 20, in file
arg_patterns)):
File "/home/sam/anaconda/lib/python2.7/site-packages/pyke/krb_compiler/compiler_bc.py", line 18, in <lambda>
arg, arg_context),
File "/home/sam/anaconda/lib/python2.7/site-packages/pyke/contexts.py", line 344, in match_pattern
bindings.bind(var.name, var_context, pattern_b, b_context)
File "/home/sam/anaconda/lib/python2.7/site-packages/pyke/contexts.py", line 186, in bind
else isinstance(val, pattern.pattern)
AssertionError
[Finished in 0.2s with exit code 1]
[cmd: ['python', '-u', '/home/sardendhu/Desktop/Tataatsu_projects/PYKE/main.py']]
[dir: /home/sam/Desktop/PYKE]
[path: /opt/pgxl/bin:/usr/local/s
我不确定出了什么问题。任何帮助将不胜感激