#32 Environment classes always refer to last created environment


Each time a new Environment is created, all __init__ methods of all Environment inner classes will refer to the most recently created CLIPS environment. This leads to unexpected errors. For instance:

import clips
env1 = clips.Environment()
env2 = clips.Environment()
t = env1.BuildTemplate("t1", "(slot s1)")
f = t.BuildFact()
f.Slots["s1"] = "1"

will cause the following

Traceback (most recent call last):
File "foo.py", line 6, in ?
f.Slots["s1"] = "1"
File ".../site-packages/clips/_eclips_wrap.py", line
492, in __setitem__
_c.env_putFactSlot(self.__env, self.__fact, name, _py2cl(v))
_clips.ClipsError: C90: fact slot could not be modified

Obviously this would not be the case, and the low-level module only reports this error because an the fact corresponding to f doesn't really exist in the actually used environment - which is, unexpectedly, env2.


  • Francesco Garosi

    Logged In: YES
    Originator: YES

    The fixes for this bug or request have been accepted and
    committed to current RCS tree: next release will include these
    fixes, possibly among other enhancements.

  • Francesco Garosi

    • status: open --> closed-fixed

Log in to post a comment.