http://python.pastebin.com/m26864a1b
Traceback (most recent call last): File "./loopy", line 328, in <module> set[current_set][current_section][current_key] = current_value KeyError: 'DEFAULT' First, apologies for the formatting - I'm teaching myself python after having taught myself PHP, so I probably make amateur mistakes. I'm currently working in a 120-character-wide environment for my own purposes, with plans to perhaps change this later. The purpose of this program, as it stands now, is to read an INI file and parse it, line by line. Doing this by hand because my program will take the INI file and generate multiple INI files for another program, and loop through them (hence "Loopy" - I didn't come up with the name.) My "Loopy" commands are lines in the INI that begin with a colon, e.g. ":SET=somename" starts a new set. Lines 294-335 are where I've determined that the input line contains a key-value pair. Well, I should backtrack. "set" contains not only the various sets, but I track where I'm at in set["+current+"] - I have to track the current set and section (INI section, e.g. [DEFAULT]). So what I'm trying to do on line 328 is to store the current key/value pair in a dictionary under the proper section, which is in the proper set. Hence, set[setname][section][key]=value You can see my insanely-verbose log here: http://python.pastebin.com/m6dcfb96d That was from a run where I commented out line 328. (that dos the actual Googling "KeyError" seems to indicate problems while trying to *retrieve* values from a dictionary, whereas I'm trying to *set* values. Does anyone have any insight? Also, although I'm not formally requesting feedback on my coding style, that's mainly because I don't want to waste anyone's time. But if you have suggestions, please - I'm open. I'm self-taught and I'm sure I'm doing lots of stupid things. I just hope it's not all bad. ;-) Thank you most sincerely, -Isaac Eiland-Hall
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor