Receiving error in python script

When running the following script, I am receiving the error which circled below. Any ideas why this error may be occuring.

Hi Mark, and welcome.

First a note: it’s almost always better to copy and paste your code directly into a message rather than to post a screenshot. Some users can’t see the screenshot at all due to either technological or biological limitations, and nobody at all can copy the code to try it themselves to reproduce your problem.

However, here’s some general advice that may help: you’ve fallen into the very common trap of catching exceptions just to print them and ignore them. Unless there’s something specific that you want to handle, let the exceptions through! They’re wonderful debugging aids, and outside of very rare circumstances it’s not harmful to let them raise. Remove all of your try: and except Exception as e: blocks, and your issue will likely become clearer because you’ll be able to see exactly where the exception is being raised.

My suspicion is that it’s happening at the sr['temp'] = tag line, likely because points = server.search(tag) returned a False-y result, so the sr = ... line within the for point in points: block was never run.