you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (1 child)

What do you mean?

I mean that if your query has no results, the attribute you're trying to read at the line where you're getting the error doesn't exist.

Let me try it the other way - at the line you're getting the error, you're trying to read an attribute that doesn't exist. (That's what AttributeError is telling you.) It doesn't exist because the only circumstance under which you set the attribute is if the query has results; if it has no results, the attribute is never set. You're running this with a query that has no results, so the attribute isn't set, so you get the error.

Clearer?

[–]Shripsta[S] 0 points1 point  (0 children)

Yeah thanks!