I’ve noticed that when working with the display conduit class in python, errors in functions such as PreDrawObjects(), DrawOverlay, PostDrawObjects etc are not shown with the usual error/traceback popup window.
Attached is some sample code, when line 50 is reached the code fails and no error is thrown, the script continues as if no error had occurred but the mesh is not drawn. This makes debugging changes to these functions really tough. When line 50 is uncommented the script works as normal.
Does anyone else have a workaround for this? Or is it a bug that could be fixed?
conduit_basic.py (1.9 KB)
Hi @tristanryerparke1, put your event code into
try: except blocks to get the error printed:
def PreDrawObjects(self, drawEventArgs): try: badcode = badcode2 gvp = drawEventArgs.Display.Viewport if gvp.DisplayMode.EnglishName.ToLower() == "wireframe": drawEventArgs.Display.DrawMeshWires(self.mesh, self.color) else: drawEventArgs.Display.DrawMeshShaded(self.mesh, self.material) except Exception as ex: print ex
it then prints this to the command line:
global name ‘badcode2’ is not defined
it is unfortunately by design that errors in events are not thrown the regular way.
This worked very well.