Is there a way of showing a configurable warning or error from within a custom node which is based on a python code block? This would significantly help with debugging which as a newcomer I’m finding very challenging at present.
Maybe Traceback?
but where is the traceback shown? There’s no stderr or stdout when using python in dynamo that I can see - it baffles me why this isn’t available.
I’ve tried raising exceptions in the python code but nothing is shown anywhere.
Further to this, if you have a python script as a code block, you get exceptions and errors, but as soon as you put it in a custom node you get nothing.
The only option I can see is to write to a log file
as exception:
except:
# if error accurs anywhere in the process catch it
import traceback
errorReport = traceback.format_exc()
#Assign your output to the OUT variable
if errorReport == None:
OUT = result
else:
OUT = errorReport
2 Likes
to complete @Deniz_Maral 's post, here an alternative with a redirection of sys.stdout (with a memory file) to the variable OUT
3 Likes
thanks redirecting stdout to OUT is an elegant solution which I now have working
2 Likes