I\'ve written a bash script that is doing exactly what I want it to do, but kicking out the following error:
close failed in file object destructor: sys.except
I was seeing this error when piping output from a Python 2.6.2 script into the head command in bash on Ubuntu 9.04. I added try blocks to close stdout and stderr before exiting the script:
head
bash
try
stdout
stderr
try: sys.stdout.close() except: pass try: sys.stderr.close() except: pass
I am no longer seeing the error.