Solved! Go to Solution.
value = sys.stdout print value
value = sys.stdout arcpy.AddMessage(str(value))
origapp = sys.executable if "ArcMap" in origapp: arcpy.AddMessage("...The python script is being executed from ArcGIS/Toolbox") elif "Pythonwin.exe" in origapp: print "...The python script is being executed from PythonWin"