clairenied15 / heart_rate_sentinel_server

0 stars 0 forks source link

AttributeError: 'dict' object has no attribute 'iteritems' #3

Closed clairenied15 closed 5 years ago

clairenied15 commented 5 years ago

I found a few lines of code on Stack Exchange to put all of the heart rates for a given user_id into a list and then make a new dictionary out of it. However, when I try to run this with my hr_server.py code (lines 28-31) I am getting AttributeError: 'dict' object has no attribute 'iteritems'. I looked it up and it says that iteritems can be used with a dictionary, so I'm not sure what's happening here.

dward2 commented 5 years ago

I believe that .iteritems was removed when going from python 2 to 3. Try using .items instead.

dward2 commented 5 years ago

As a suggestion, when you get errors like this, check the python documentation to be sure you are using the term correctly. For example, you can go to https://docs.python.org/3/, and then enter "dict.iteritems" into the search bar. Such a search brings up an entry for "What's New in Python 3.0" that says dict.iteritems() is no longer supported.