r/learnpython • • 5d ago

i got UnboundLocalError: local variable 'queue' referenced before assignment, how to fix please

def main(ips, users, passwords, ThreadNumber):

queue = queue.Queue(maxsize=20000)

for t in range(ThreadNumber):

try:

t = Apophis(queue)

t.daemon = True

t.start()

except Exception as e:

break

2 Upvotes

6 comments sorted by

View all comments

Show parent comment

1

u/supercoach 4d ago

Um, actually I said they should consider it a reserved word so that they don't use it. No assertion was made that it actually was a reserved word and no correction is needed.