Redeclared 'detail_phone' defined above without usage

sql_cursor.execute("SELECT TOP 1 VALUE FROM TABLE_NAME WHERE NAME = ?", where_value)
detail_phone = ''
for item in sql_cursor.fetchall():
    detail_phone = item.VALUE[1:].strip()

if not detail_phone:
    print('{} not found.'.format(where_value))
    exit()
prettyPrint();

I'm getting a constant message that states "Redeclared 'detail_phone' defined above without usage" on the detail_phone = item.VALUE line within the for loop.

I've used this technique many times before and never encountered this message before, detail_phone is being used twice beyond the "if not detail_phone" line, so i don't really get why this is happening.

Any insite?

Please sign in to leave a comment.