Skip to content

Not the expected result #37

@AhmedGDeeb

Description

@AhmedGDeeb

I am trying to run this code:

class RuleEng(KnowledgeEngine):
    @Rule(salience=1)
    def r1(self):
        print("Execution r1 second")
        pass
    @Rule(salience=2)
    def r2(self):
        print("Execution r2 first")
        pass
    @Rule(Fact(foo="bar"))
    def Foo(self):
        print("Execute Foo")
        pass

engine = RuleEng()
engine.reset()
engine.declare(Fact(foo="bar"))
print(engine.facts)
engine.modify(engine.facts[1], foo="bar2")
engine.modify(engine.facts[1], foo="bar")

and got this error:

<f-0>: InitialFact()
<f-1>: Fact(foo='bar')

Traceback (most recent call last):
  File ***, in <module>   
    engine.modify(engine.facts[1], foo="bar")
                  ~~~~~~~~~~~~^^^
KeyError: 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions