#15 Evaluating a function call in a module throws an exception

Johan Lindberg

I'm having trouble evaluating a function call that's placed in a module. I'm trying to make a Python equivalent of the ClipsJNI WineDemo example but I'm running in to trouble when I have to call the function WINES::get-wine-list. This snippet re-creates the problem:

>>> import clips
>>> clips.Load("c:/program/clips/pyclips/winedemo.clp")
>>> clips.Eval("(WINES::get-wine-list)")

Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
File "C:\Python25\lib\site-packages\clips\_clips_wrap.py", line 3430, in Eval
return _cl2py(_c.eval(expr))
ClipsError: C10: unable to evaluate expression

It doesn't raise an error if I define it without a module specifier and since ClipsJNI seems to be able to handle it I guess it has something to do with the Python module and not the C interface.


  • Johan Lindberg
    Johan Lindberg

    • labels: 653839 --> 656385
    • milestone: 416306 --> 414448
  • Johan Lindberg
    Johan Lindberg

    Logged In: YES
    Originator: YES

    I changed this to a feature request since it turns out that Clips 6.24 does not support calling a function in a different module.

    • labels: 656385 -->
    • milestone: 414448 -->
    • priority: 5 --> 6
    • assigned_to: nobody --> franzg
  • Logged In: YES
    Originator: NO


    I was just writing a comment as I discovered the one you added. Actually I never tried to externally evaluate a function defined within a defmodule. Maybe I should try to work out a way to extract the list of references to functions defined in defmodules, and expose them through the "Module" class interfaces, as having things like "Module.BuildFunction()" and "Module.PrintFunctions()" and no way to traverse the function list seems inconsistent to me.

    Maybe it sounds more like a workaround, but I hope it could do the job until 6.3 is stable. I's not easy for me to maintain too many versions of PyCLIPS, although I'm really considering to start supporting 6.30 and to drop 6.23.