Menu

Help passing variable to python script

Help
Oubeid
2013-09-16
2013-09-18
  • Oubeid

    Oubeid - 2013-09-16

    Hi,
    I am new to PyKE and Python and would like some help. This may be a stupid question.

    I have the rule below
    treatment_species
    foreach
    decon2.contaminant_found_is($species, $conc)
    decon2.treatment_technology_effectiveness_is($technology, $species, $effect, $nodette)
    decon2.minimum_treatment_effectiveness_is($target_level, $nodemte)
    check $target_level <= $effect
    assert
    decon2.treatment_species_is($technology, $species, $effect, $nodette)
    python print 70"-"
    python print '%-
    s %s %s' % (30, $species, 25, $technology, 10, $effect)

    and the python program below
    def fc_test():
    print 70"="
    print '%-
    s %s %s' % (25, "Species", 25, "Technology", 18, "Effectiveness(%)")
    engine.reset() # Allows us to run tests multiple times.
    engine.activate('fc_decon') # Runs all applicable forward-chaining rules.

    print 70*"="
    print
    print "done."
    

    When I run the program, everything works fine. However, I would like to move the python code in the rules to the python program, to get the asserted variables in treatment_species_is(....) and have them printed from the main python program.

    Any help will be greatly appreciated.

    Thanks,

    Oubeid

     
  • Oubeid

    Oubeid - 2013-09-18

    I figured it out.
    Thanks.

     

Log in to post a comment.