Python print statement


#1

I’m looking to observe/debug my python node in action by inserting diagnostic print statements at key points (yes, crude but effective). How does one monitor standard Python “print”, or is the only feedback through the OUT parameter?

Thanks,

Ned R


#2

Usually you will create an empty list called debug and append results to debug. Lastly you assign debug to OUT


#3

Well. I found one way, which is to redirect stdout to a file:


stdsave = sys.stdout
fout = open(r’C:\Users\Ned.Reifenstein\output.txt’,‘w’)
sys.stdout = fout
print “This is a message”

sys.stdout = stdsave
fout.close()


This way you can keep diagnostic print statements out of the way of OUT. However, it sure would be nice to redirect stdout to the dynamo console.

 

 


#4

Great idea - please make feature request for this on GitHub.