我的剪辑文件包含(printout t"text")
和bind ?var (read)
语句。如果我从 C 代码下面运行 .clp 文件,程序将打印到控制台并按预期从控制台读取我的输入,从而使其成为程序和用户之间的交互式会话。
#include "clipscpp.h"
#include <iostream>
#include<stdlib.h>
using namespace std;
int main()
{
CLIPS::CLIPSCPPEnv theEnv;
theEnv.Load("KB.clp");
theEnv.Reset();
theEnv.Run(-1);
return 0;
}
但是,如果我尝试使用 PyCLIPS 在 python 中加载 .clp,则既不工作(printout)
也不(read)
工作,程序终止而不做任何事情。
import clips
clips.Load("KB.clp")
clips.Clear()
clips.Reset()
clips.Run(-1)
如何获得与从 C 运行相同的结果?