Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python "Key Error"
#2
A copy of my most recent reply on the old forums:

It's not writing it for the output. It's assigning to the output. You won't get a key error on assignment. If the key isn't there during assignment the key just gets added. The error is when it's accessing self.variables[name]. On access it will give the key error if the key isn't there. The traceback shows this is happening during system.calculate, so self is equal to system, and thus system.variables does not have the key 'PNEU'. The system variable is assigned when reading the file, leading to the conclusion that 'PNEU' is not in the file.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
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