noxdafox / clipspy

Python CFFI bindings for the 'C' Language Integrated Production System CLIPS
BSD 3-Clause "New" or "Revised" License
177 stars 32 forks source link

Environment becomes unusable after error #26

Closed slozovsky closed 5 years ago

slozovsky commented 5 years ago

Environment becomes unusable after error:

import clips

env = clips.Environment()

env.eval('(printout t "Hello World!" crlf)')

try:
    env.eval('(if (= 0 nil)then (printout t "Hello World!1" crlf))')
except Exception as e:
    print "EXCEPTION", e

print "attempt to call CLIPS"
env.eval('(printout t "Hello World!2" crlf)')
print "attempt to call CLIPS2"
env.eval('(printout t "Hello World!3" crlf)')

(= 0 nil) causes an error. It is expected that "Hello World!2" and "Hello World!3" would be printed as in CLIPS itself. But that doesn't happen. env.eval('(printout t "Hello World!2" crlf)') throws anv error.

Similar CLIPS example:

$ ./clips
         CLIPS (6.30 3/17/15)
CLIPS> (printout t "Hello World!" crlf)
Hello World!
CLIPS> (if (= 0 nil)then (printout t "Hello World!1" crlf))
[ARGACCES5] Function = expected argument #2 to be of type integer or float
CLIPS> (printout t "Hello World!" crlf)
Hello World!
CLIPS> (exit)
noxdafox commented 5 years ago

Hello,

this is a bug in CLIPS which was fixed in 6.31. Unfortunately, it seems CLIPS 6.30 fixes were not released. I will ask the author to release CLIPS 6.32 and update the Makefile once done.

For the time being, you could workaround this issue by pointing the Makefile to my GitHub mirror of CLIPS code. This should get you CLIPS 6.32 will several fixes done between 2016-2018.

$ make CLIPS_SOURCE_URL=https://github.com/noxdafox/clips/archive/63x.zip MAKEFILE_NAME=makefile.gcc
noxdafox commented 5 years ago

Ticket created against upstream.

slozovsky commented 5 years ago

That worked. Thanks!

Having 63x.zip works for me, but is sure will be nice if the fixes are published in the upstream. So, thanks for creating the upstream ticket, too.

noxdafox commented 5 years ago

CLIPS 6.31 has been released and the Makefile is already pointing to the new release. This should address your issue so I'm closing it.

Please feel free to re-open it if the problem persists.