My clip file contains (printout t"text")
and bind ?var (read)
statements. If I run the .clp file from below C code, the program prints to console and reads my input from console as expected, thus making it an interactive session between program and the user.
#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;
}
But, If I try to load .clp in python using PyCLIPS, neither (printout)
nor (read)
works and the program terminates without doing anything.
import clips
clips.Load("KB.clp")
clips.Clear()
clips.Reset()
clips.Run(-1)
How can I achieve the same result as running from C ?
I would suggest something like that:
After that, you can write more CLIPS-like code: