stefankoegl / kdtree

A Python implementation of a kd-tree
ISC License
365 stars 118 forks source link

In Python3.5 on Ubuntu 16.04 tree.search_knn method failed with error #31

Closed cfdbwrbq closed 7 years ago

cfdbwrbq commented 7 years ago

tree.search_knn((2,2), 3) Traceback (most recent call last): File "", line 1, in File "/home/user/env/lib/python3.5/site-packages/kdtree.py", line 420, in search_knn self._search_node(point, k, results, get_dist) File "/home/user/env/lib/python3.5/site-packages/kdtree.py", line 449, in _search_node self.left._search_node(point, k, results, get_dist) File "/home/user/env/lib/python3.5/site-packages/kdtree.py", line 437, in _search_node results.add((self, nodeDist)) File "/home/user/env/lib/python3.5/site-packages/bounded_priority_queue.py", line 103, in add self.heap_append(obj) File "/home/user/env/lib/python3.5/site-packages/bounded_priority_queue.py", line 108, in heap_append self.propagate_up(len(self.heap) - 1) # Index value is 1 less than length File "/home/user/env/lib/python3.5/site-packages/bounded_priority_queue.py", line 78, in propagate_up while index != 0 and self.heap[self.parent(index)][DISTANCE_INDEX] < self.heap[index][DISTANCE_INDEX]: TypeError: list indices must be integers or slices, not float

stefankoegl commented 7 years ago

Unfortunately I was not able to reproduce the bug. Can you please provide a full example on how to trigger this exception? Thanks!

cfdbwrbq commented 7 years ago

after update "bounded_priority_queue.py", problem disappeared. issue closed, many thanks! [https://www.diffnow.com/?report=hqr93]

stefankoegl commented 7 years ago

Great! Thanks for letting me know