Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Python crashes when calling sys.exit() #29
Python crashes when calling sys.exit() if pyluxcore.Init() was called with an call back. This is due to pyluxcore keeping a reference to the callback in a static boost::python::object. Everything works fine if python code exit normally without calling sys.exit().
I haven't yet found a work around to this problem.
added a commit
Dec 31, 2017
I have added a new SetLogHandler() function to the LuxCore API so it is now possible a workaround:
Calling "pyluxcore.SetLogHandler(None)" before the end fix the problem.
Yes there is a static object holding the reference to a python object (i.e. a function call back to print log messages) and when the destructor of the static object is called, the python interpreter as already gone.
It can be solved with the try/finally or with the atexit but both solutions are not transparent for the API user: they must be coded in the application.
Yes, I meant doing the python
Another solution would be to have everything, including the system context in classes, then it would get destroyed when the interpreter shuts down and the cleanup could happen there.