Closed mchl0203 closed 3 years ago
You cannot wrap the Network, NetworkGraph objects inside a function. Previously there has been a similar issue but I cannot find it now.
The reason is that python binding is created using swig so the API has some differences from most other Python API you have used. The stmatch model is created by taking reference rather than copying the inner network and graph object. In your function, the network and graph objects are freed when the function finishes. Then the model links to some non-exist network and graph objects so you encounter this error.
You need to put everything in the global scope and avoid this way of returning only a single model.
In the future, maybe every object could be defined as shared pointer to support this way of invoking.
Okay, thank you for your detailed reply.
I try to define config initialization as a function, and running the program will cause a error. code:
error:
Segmentation fault (core dumped)
I tried to use py2 and py3 to run the code, but the program will report errors. Could you trouble me to troubleshoot this error?very thankful~