Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python "Key Error"
#1
i made an .fcl file in qtfuzzylite.I want to load it in python 2.7 with fcl Reader.It must do some calculation with the given inputs then it must give the output value.when i run the program it writes Key Error 'PNEU

I used this example: http://pyfuzzy.sourceforge.net/doc/quickstart.html



import fuzzy.storage.fcl.Reader
system = fuzzy.storage.fcl.Reader.Reader().load_from_file("Ballpositioner2.fcl")
 
# preallocate input and output values
my_input = {
        "REQ_POS" : 0.0,
        "REQ_ANGLE" : 0.0,
        "DESIRED" : 0.0,
        
        }
my_output = {
        "PNEU" : 3,
        }
 
# if you need only one calculation you do not need the while

        # set input values
my_input["REQ_POS"] = 10
my_input["REQ_ANGLE"] = 20
my_input["DESIRED"] = 30
        # calculate
        
system.calculate(my_input, my_output)
 
        # now use outputs
b = my_output["PNEU"]



line 3:0 extraneous input u'VAR_INPUT' expecting Identifier

Traceback (most recent call last):
  File "D:\Szabolcs\szte\Szakdolgozat\Python\python 27\ewrwewerwer.py", line 23, in <module>
    system.calculate(my_input, my_output)
  File "C:\Python27\lib\site-packages\fuzzy\System.py", line 93, in calculate
    self.defuzzify(output)
  File "C:\Python27\lib\site-packages\fuzzy\System.py", line 76, in defuzzify
    output[name] = self.variables[name].getValue()
KeyError: 'PNEU'
Reply


Messages In This Thread
python "Key Error" - by a9balsza - Sep-24-2016, 08:15 AM
RE: python "Key Error" - by ichabod801 - Sep-24-2016, 12:12 PM
RE: python "Key Error" - by a9balsza - Sep-24-2016, 01:23 PM
RE: python "Key Error" - by Yoriz - Sep-24-2016, 01:31 PM
RE: python "Key Error" - by a9balsza - Sep-24-2016, 01:36 PM
RE: python "Key Error" - by Yoriz - Sep-24-2016, 01:43 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020