Writing the binary value for ^D into the stream will not do anything. That value signals the shell to close the stream, as such it only has significance when you're typing something into the shell.
To the OP: writing an EOF to a stream without closing it makes no sense. EOF means just that--end of file. Once the program reaches an EOF, it can't read any more values from the stream, so keeping it open to write more stuff into it wouldn't even work. -- http://mail.python.org/mailman/listinfo/python-list