Hi! First, generate a file named "data.txt" as follows:
-- 8< ---------------------------------- for i in range(1,100): print '.' * 80 -- 8< ---------------------------------- After that, save the following snippet as "test.py" in the directory containing "data.txt": -- 8< ---------------------------------- import sys object_file = open('data.txt', 'rb') for line in object_file: sys.stdout.write(line) -- 8< ---------------------------------- Finally, run the following Unix shell command in the containing directory: -- 8< ---------------------------------- python test.py | head -- 8< ---------------------------------- At the end of printing some lines, the following error is reported: -- 8< ---------------------------------- close failed in file object destructor: Error in sys.excepthook: Original exception was: -- 8< ---------------------------------- How to suppress that unwanted error message? After all doing something like the following does not give such an error: -- 8< ---------------------------------- cat data.txt | head -- 8< ---------------------------------- Thank you very much. -- Best regards, Eus (FSF member #4445) _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor