I'm new to python and just discovered a strange error when trying to iterate through a queue.
Here's a code snippet:
frontier = q.PriorityQueue()
for goal in goals:
portals = findPortals(maze)
comb_value = heuristic(startX, startY, goal[0], goal[1])
frontier.put_nowait((comb_value, heuristic(startX, startY, goal[0], goal[1]), 0, startX, startY, startX, startY))
for portal in portals:
heur = portalHeuristic(maze, startX, startY, goal[0], goal[1])
frontier.put_nowait((heur, heur, 0, startX, startY, startX, startY))
for elem in list(frontier):
print(elem)
When trying to print out the elements it says TypeError: 'PriorityQueue' object is not iterable
. Can I fix this somehow? I tried to find some solutions on here, but I didn't really find anything I understood...