AttributeError: ‘dict’ object has no attribute ‘iteritems’ – Python

Hey everyone,

Just running through object detection samples for Tensorflow and I encountered the following error:


AttributeError: ‘dict’ object has no attribute ‘iteritems’

The issue seems to be that the sample hasn’t been made compatible with Python 3.x. Simply make the following change and it should work:

# Original
for cls, new_image in new_images.iteritems():

# Changed
for cls, new_image in new_images.items():

Thanks to the following StackOverflow post:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.