failure to send buffered output stream requirements to make some of this more concreteexample - illustrates how some of these complexities apply to redirected standard streamsby attempting to connect them to both text and binary mode files produced by open and accessing them with print and input built-ins much as redirected script might example - pp \internet\sockets\test-stream-modes py ""test effect of connecting standard streams to text and binary mode files same holds true for socket makefileprint requires text modebut text mode precludes unbuffered mode -use - or sys stdout flush(calls ""import sys def reader( )tmpsys stdin sys stdinf line input(print(linesys stdin tmp readeropen('test-stream-modes py'readeropen('test-stream-modes py''rb'worksinput(returns text worksbut input(returns bytes def writer( )tmpsys stdout sys stdoutf print( 'spam'sys stdout tmp writeropen('temp'' 'print(open('temp'read()worksprint(passes text str to write(writeropen('temp''wb'writeropen('temp'' ' fails on printbinary mode requires bytes fails on opentext must be unbuffered when runthe last two lines in this script both fail--the second to last fails because print passes text strings to binary-mode file (never allowed for files in general)and the last fails because we cannot open text-mode files in unbuffered mode in python (text mode implies unicode encodingshere are the errors we get when this script is runthe first run uses the script as shownand the second shows what happens if the second to last line is commented out ( edited the exception text slightly for presentation) :\pp \internet\socketstest-stream-modes py "" '"""\ spam network scripting