EDITED HEAVILY with some new information (and a bounty)
I am trying to create a plug in in python for gimp. (on windows) this page http://gimpbook.com/scripting/notes.ht
as noted in How do I output info to the console in a Gimp python script?
add
import sys sys.stderr = open( 'c:\\temp\\gimpstderr.txt', 'w') sys.stdout = open( 'c:\\temp\\gimpstdout.txt', 'w')
at the beginning of the plug in file.