Open dsleiter opened 1 year ago
Hey there, I looked into this and I found that Panda uses sys.exit()
so the error is inevitable. Here is the link to extended traceback
https://pastebin.com/CyzifM4V
I guess we can handle the exception using a try block in the renderer.py
like this,
Thanks for the investigative work @Ln11211!
Catching the SystemExit
seems like it would work as a short-term work-around, but I'd be worried about potential side effects. What should happen if the application was called via a script rather than from a notebook? What should happen if there was an error and sys.exit
was called with a non-zero error from another part of the ShowBase?
Looking at pandas documentation, it seems like the function which calls sys.exit()
is made to be overridden (since it says "the default implementation...")
https://docs.panda3d.org/1.10/python/reference/direct.showbase.ShowBase#direct.showbase.ShowBase.ShowBase.finalizeExit
So we could maybe override finalizeExit
or another exit function it in Cerebro_window
with some other behavior.
Does Panda3D documentation give any guidance on implementing exit functionality?
Hey @dsleiter , after looking further into this issue, I understood that this behavior of the viewer is only specific to notebooks and there is a further breakdown of the viewer when we try to run the script right after we close it,
Exception: Attempt to spawn multiple ShowBase instances!
And the Kernel dies. This has nothing to do with Cerebro, but everything to do with the 'Sys.exit()'
Steps to reproduce
traceback I have attached the traceback and also a Stack overflow thread that address the same issue.
This weird breakdown of the Panda is only due to the Sys.exit()
and happens only in notebooks and not in Terminal. After the initial SystemExit exception, the Panda breaks down when tried to run again. Read the StackOverflow thread for detailed explanation.
Steps to reproduce:
The following error is printed inside the notebook: