[Tutor] Key Error

Bob Gailer bgailer at alum.rpi.edu
Sun Jul 8 23:41:05 CEST 2007

Sara Johnson wrote:
> On how the 'h' was created....
> Well, it appears 'h' is referenced in a few spots in this code.  It 
> looks like initially, at least, a dictionary 'h' is created and some h 
> keys and sub keys follow, obviously from the purpose of this project 
> (having to do with pickling), h is assigned:
> h=cPickle.load(inf)
> Is this because of the sub keys that follow? 
This means that some (same or other) program created h, "pickled" it and 
most likely wrote it to a file. So that program is failing in some way 
to create the correct keys for the dictionaries that comprise the values 
of h.
> Could this be why I'm not able to create 'NEWI'?
Again note you are not trying to create anything.  newi=h[key]['NEWI'] 
is attempting to reference an existing key, and the key does not exist.
> Sorry if I'm missing something or not answering your question, I'm 
> highly confused!
Of course you are. Going into a totally new realm with just C under your 
belt. If you'd like, give me a call. We might be able to cover more 
ground faster on the phone.

Bob Gailer
510-978-4454 Oakland, CA
919-636-4239 Chapel Hill, NC

More information about the Tutor mailing list