hmm, are you using 'len' as a variable anywhere else in your program?
Check to see if you are using 'len' as a variable in your program, because thats where i get the error:
dic = {1:1,2:2,3:3,4:4}
print len(dic)
def main():
print len(dic)
len = len(dic)
if __name__ == '__main__':
main()
and the output:>>>
4
Traceback (most recent call last):
File "C:/Python25/testDICTS.py", line 10, in
main()
File "C:/Python25/testDICTS.py", line 6, in main
print len(dic)
UnboundLocalError: local variable 'len' referenced before assignment
Tis a funny error though, i never did work it out, i just changed my code till i didn't get it, hehe if that doesn't work then i don't know, sorry
happy coding
a1eio