I am getting an error "unhashable dict" for tmp_str = [{category : name }]. category and name are variables.
Tried options are
- tmp_str = [{category : name }]
- tmp_str = {category : name }
Complete code is here
def isAttributesIntheName(file_name,message):
table = db_client.Table(table_name)
count = table.item_count
json_msg = json.dumps(message)
print (json_msg)
numCount = 0
loop = 0
print (count)
for numCount in range (count):
name = table.scan()['Items'][numCount]['name']
result = file_name.lower().find(name)
category = table.get_item(Key={'name':name})
if result > 0:
tmp_str = [{category : name }]
json_str1 = dict(**json_str,**{tmp_str })
loop = loop + 1
print (json.dumps(json_str1))