[Tutor] TypeError: dict objects are unhashable
Alan Gauld
alan.gauld at freenet.co.uk
Thu Mar 23 19:28:48 CET 2006
Ben,
Others have addressed the cause of the error, but...
> accounts = {}
> UserCursor.execute(sqlstr)
> rows = UserCursor.fetchall()
> UserConn.commit()
> for row in rows:
> U = row['User']
> P = row['Password']
> InnerDict = {}
> InnerDict[U] = P
> accounts[InnerDict] = U
>
> But I get:
> TypeError: dict objects are unhashable
It really helps if you post the whole error message since it
will highlight the actual line causing the problem. Please post
the whole stacktrace from the message in future.
Alan G.
More information about the Tutor
mailing list