Python gives OSError: exception: access violation reading 0x0000000000000000 when calling the native function CreatePaths
|
res = HFPython.CreatePaths( |
|
graph_ptr, |
|
c_starts, |
|
c_ends, |
|
cost_str, |
|
byref(path_ptrs), |
|
byref(data_ptrs), |
|
byref(c_sizes), |
|
c_path_num, |
|
) |
Here is a test file for the error:
from dhart.spatialstructures import Graph
from dhart.pathfinding import DijkstraFindAllShortestPaths, DijkstraShortestPath, calculate_distance_and_predecessor
g = Graph()
g.AddEdgeToGraph(0, 1, 100)
g.AddEdgeToGraph(0, 2, 50)
g.AddEdgeToGraph(1, 3, 10)
g.AddEdgeToGraph(2, 3, 10)
g.CompressToCSR()
# Define the correct path
correct_path = [[50, 0], [10, 2], [0, 3]]
# Find the same path num_paths times
num_paths = 1000
starts = [0] * num_paths
ends = [3] * num_paths
SPS = DijkstraShortestPath(g, starts, ends)
# Assert that we got an output back of the correct size
assert len(SPS) == num_paths
# Iterate through every path in the output
for SP in SPS:
# Assert that this path isn't null
assert(SP is not None)
# Assert that it equals correctpath
for i in range(0, len(correct_path)):
assert correct_path[i][0] == SP[i][0]
assert correct_path[i][1] == SP[i][1]
Python gives
OSError: exception: access violation reading 0x0000000000000000when calling the native functionCreatePathsdhart/src/Python/dhart/pathfinding/pathfinder_native_functions.py
Lines 112 to 121 in 0d96277
Here is a test file for the error: