From ae18928064b3830414faad876309ecbc4b742891 Mon Sep 17 00:00:00 2001 From: David Vierra Date: Mon, 15 Aug 2011 19:03:00 -1000 Subject: [PATCH] print a more informative keyerror --- nbt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nbt.py b/nbt.py index 0de2363..4652ec6 100644 --- a/nbt.py +++ b/nbt.py @@ -335,7 +335,7 @@ class TAG_Compound(TAG_Value, collections.MutableMapping): #if(len(hits)): return hits[0]; for key in self.value: if key.name == k: return key - raise KeyError("Key {0} not found".format(k)); + raise KeyError("Key {0} not found in tag {1}".format(k, self)); def __iter__(self): return itertools.imap(lambda x:x.name, self.value); def __contains__(self, k):return k in map(lambda x:x.name, self.value);