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.excepthook is missing lost sys.stderr
I’m completely stumped on how to address this. Here is the script:
#!/bin/bash
usage () { echo "${0##*/} inputfile outputfile"; exit 1; }
(($#==2)) || usage
INPUTFILE="$1"
OUTPUTFILE="$2"
# All that is written between between the 'cat' command and
#+ 'EOF' will be sent to the output file.
cat <<EOF >$OUTPUTFILE
$(date "+Generated on %m/%d/%y at %H:%M:%S")
DATA AUDIT: $1
------------
COLUMN NAMES
------------
$(csvcut -n $INPUTFILE)
---------------------------------------
FIRST TEN ROWS OF FIRST FIVE COLUMNS
---------------------------------------
$(csvcut -c 1,2,3,4,5 $INPUTFILE | head -n 10)
------------
COLUMN STATS
------------
$(csvcut $INPUTFILE | csvstat )
---END AUDIT
EOF
echo "Audited!"
I am pretty new to shell scripts and very new to python. I would be grateful for any help.
I was seeing this error when piping output from a Python 2.6.2 script into the
headcommand inbashon Ubuntu 9.04. I addedtryblocks to closestdoutandstderrbefore exiting the script:I am no longer seeing the error.