1

I'm using PyCLIPS to integrate CLIPS in a program that should act as a ECA-Server (event-conditon-action). There are incoming events that, together with the system state, may or may not trigger rules that then emit actions on a message bus.

The system state manifests itself in form of instances whose slots are being modified depending on the incoming events.

The software is intended to be a long-lived service, but when an error occurs during the execution of a rule for example through a misnamed handler:

ERROR: [MSGFUN1] No applicable primary message-handlers found for event-handler.
[PRCCODE4] Execution halted during the actions of defrule event-rule.

The clips session becomes unresponsive to new messages. Slots are no longer updated using:

clips_instance.Send(event, event_args)

There is nothing happening in clips even with clips.DebugConfig.WatchAll() there is no debug output.

Example:

>>> import clips
>>> clips.Build("(defclass POINT (is-a USER) (slot x) (slot y))")
>>> clips_instance = clips.BuildInstance("p1","POINT","(x 3) (y 5)")
>>> clips_instance.Send("get-x","")
<Integer 3>
>>> clips_instance.Send("get-z","")
<Symbol 'FALSE'>
>>> clips_instance.Send("get-y","")
<Symbol 'FALSE'>
>>> 

Is there any possibility to avoid this or recover from this state?

Amittai Shapira
  • 3,749
  • 1
  • 30
  • 54
Fl0v0
  • 900
  • 11
  • 27
  • This looks to be a very old issue: https://sourceforge.net/p/pyclips/discussion/390146/thread/3d9ece3a/. It's likely that the EvaluationError flag is not getting reset after PyCLIPS calls into the CLIPS API, so you may be able to solve the issue by placing this line of C code into the appropriate places in the PyCLIPS code: SetEvaluationError(GetCurrentEnvironment(),FALSE); – Gary Riley Jun 30 '16 at 23:48
  • @GaryRiley Thank you! i will look into this. So you assume the error lies in PyCLIPS not in CLIPS itself? I will update the topic of the question to reflect this. – Fl0v0 Jul 04 '16 at 07:52
  • @ FIOvO I wasn't able to figure out how to put debugging statements into PyCLIPS and rebuild it, but I think that's the issue. The error reporting and recovery mechanism in CLIPS needs an overhaul, but as things stand today wrapper classes should reset the error state after making calls that can execute CLIPS code. – Gary Riley Jul 04 '16 at 17:23

0 Answers0