Trying to create a simple “Methods” node which takes in variables and returns methods for debugging on the back end.
I wanted to add the .Name of the variables in addition to the dir() but the exception to catch and report the error (name not found) doesn’t work…
def to_list(item_or_list=[]):
return item_or_list if type(item_or_list) is list else [item_or_list]
x=to_list(IN[0]) ##Covnert to list if single item
OUT=[]
for y in x:
out=[]
try:
out.append(y.Name)
except Exception, e:
out.append(e.tostring())
try:
out.append(type(y))
except Exception, e: ##line#10 = Really won't let me do the "Exception, e" for some reason...
out.append(e.ToString())
OUT.append(out,dir(y))
this simple version works fine:
def to_list(item_or_list=[]):
return item_or_list if type(item_or_list) is list else [item_or_list]
x=to_list(IN[0]) ##Covnert to list if single item
OUT=[dir(y) for y in x]