Index: /issm/trunk-jpl/jenkins/jenkins.sh
===================================================================
--- /issm/trunk-jpl/jenkins/jenkins.sh	(revision 23731)
+++ /issm/trunk-jpl/jenkins/jenkins.sh	(revision 23732)
@@ -1,4 +1,4 @@
 #!/bin/bash
-#This bash script calls the nightlyrun.m matlab file to run our nightly test decks. 
+#This bash script calls the nightlyrun.m matlab file to run our nightly test decks.
 #It then processes the results and sends an email to the Ice developpers.
 
@@ -24,5 +24,5 @@
 	echo "File $1 not found!" >&2   # Error message to stderr.
 	exit 1
-fi 
+fi
 
 #Defaults (to avoid -eq: unary operator expected)
@@ -37,5 +37,5 @@
 #Get Operating system (OS) name{{{
 OS=$(uname -s)
-if [[ $OS == CYGWIN* ]]; then 
+if [[ $OS == CYGWIN* ]]; then
 	OS="win";
 fi
@@ -121,5 +121,5 @@
 #Install external packages    (ISSM_EXTERNALPACKAGES){{{
 
-#number of packages: 
+#number of packages:
 NUMPACKAGES=$(($(echo $EXTERNALPACKAGES | wc -w )/2))
 
@@ -190,5 +190,5 @@
 fi
 
-# Source here to include any newly installed externalpackages on the path. 
+# Source here to include any newly installed externalpackages on the path.
 source $ISSM_DIR/etc/environment.sh
 
@@ -220,10 +220,10 @@
 		make distclean
 		./scripts/automakererun.sh
-		if [ $? -ne 0 ]; then 
+		if [ $? -ne 0 ]; then
 			echo "autoreconf failed!"
 			exit 1
 		fi
 		eval "./configure $ISSM_CONFIG"
-		if [ $? -ne 0 ]; then 
+		if [ $? -ne 0 ]; then
 			echo "ISSM configuration failed (see options below)"
 			echo $ISSM_CONFIG
@@ -243,5 +243,5 @@
 		make
 	fi
-	if [ $? -ne 0 ] && [ $NUMCPUS_INSTALL -gt 1 ]; then 
+	if [ $? -ne 0 ] && [ $NUMCPUS_INSTALL -gt 1 ]; then
 		echo " "
 		echo "Compilation failed, trying to compile with only one thread"
@@ -249,5 +249,5 @@
 		make
 	fi
-	if [ $? -ne 0 ]; then 
+	if [ $? -ne 0 ]; then
 		echo "ISSM_COMPILATION failed!"
 		exit 1
@@ -263,5 +263,5 @@
 #}}}
 
-#Restore CXX/CC to their previous values 
+#Restore CXX/CC to their previous values
 export CXX=$CXX_PREVIOUS
 export CC=$CC_PREVIOUS
@@ -344,5 +344,5 @@
 done
 
-#filter out windows characters: 
+#filter out windows characters:
 cat matlab_log.log | tr -cd '\11\12\40-\176' > matlab_log.log2 && mv matlab_log.log2 matlab_log.log
 fi
@@ -353,4 +353,5 @@
 if [ $PYTHON_TEST -eq 1 ]; then
 #Launch all tests on different cpus
+#export PYTHONPATH="$ISSM_DIR/src/m/dev"
 export PYTHONSTARTUP=$ISSM_DIR/src/m/dev/devpath.py
 export PYTHONUNBUFFERED=1 #we don't want python to buffer otherwise issm.exe output is not captured
@@ -380,4 +381,15 @@
 	cat python_log$i.log >> python_log.log
 done
+fi
+
+# Check that Python did not exit in error
+exitedInError=`grep "Traceback" python_log.log | wc -l`
+
+if [ $exitedInError -ne 0 ]
+then
+	echo "Python error!"
+	cat python_log.log
+	echo "FAILURE"
+	exit 1
 fi
 # }}}
@@ -413,25 +425,25 @@
 				$SED -i.bak 's/steps=\[1\];/steps=\[1:8\];\n\ntry\n/' $FILE
 				$SED -i.bak "s/if any(steps==8)/&${STEP_EIGHT}/" $FILE
-			elif [ "${dir}" == "./IceBridge" ];	
+			elif [ "${dir}" == "./IceBridge" ];
 			then
 				$SED -i.bak 's/steps=\[1\];/steps=\[1:5\];\n\ntry\n/' $FILE
-			elif [ "${dir}" == "./IceflowModels" ];	
+			elif [ "${dir}" == "./IceflowModels" ];
 			then
 				# Almost nothing to this example
 				$SED -i.bak '1 s/^.*$/try\n\n&/' $FILE
-			elif [ "${dir}" == "./ISMIP" ];	
+			elif [ "${dir}" == "./ISMIP" ];
 			then
 				# Eight steps... none of which are implmented in the script...
 				$SED -i.bak '1 s/^.*$/try\n\n&/' $FILE
-			elif [ "${dir}" == "./Inversion" ];	
+			elif [ "${dir}" == "./Inversion" ];
 			then
 				$SED -i.bak 's/steps=\[1\];/steps=\[1:4\];\n\ntry\n/' $FILE
-			elif [ "${dir}" == "./Jakobshavn" ];	
+			elif [ "${dir}" == "./Jakobshavn" ];
 			then
 				$SED -i.bak 's/steps=\[1\];/steps=\[1:4\];\n\ntry\n/' $FILE
-			elif [ "${dir}" == "./Jakobshavn" ];	
+			elif [ "${dir}" == "./Jakobshavn" ];
 			then
 				$SED -i.bak 's/steps=\[1\];/steps=\[1:4\];\n\ntry\n/' $FILE
-			elif [ "${dir}" == "./Pig" ];	
+			elif [ "${dir}" == "./Pig" ];
 			then
 				# Step 6 is needed
@@ -439,5 +451,5 @@
 				$SED -i.bak 's/steps=\[1\];/steps=\[1:7\];\n!mv DomainOutline.bkp DomainOutline.exp;\n\ntry\n/' $FILE
 				$SED -i.bak "s/if any(steps==6)/&${STEP_SIX}/" $FILE
-			elif [ "${dir}" == "./PigSensitivity" ];	
+			elif [ "${dir}" == "./PigSensitivity" ];
 			then
 				# Step 4 is needed
@@ -445,12 +457,12 @@
 				$SED -i.bak 's/steps=\[1\];/steps=\[1:4\];\n\ntry\n/' $FILE
 				$SED -i.bak "s/if any(steps==6)/&${STEP_FOUR}/" $FILE
-			elif [ "${dir}" == "./SquareIceShelf" ];	
+			elif [ "${dir}" == "./SquareIceShelf" ];
 			then
 				# Almost nothing to this example
 				$SED -i.bak '1 s/^.*$/try\n\n&/' $FILE
-			elif [ "${dir}" == "./UncertaintyQuantification" ];	
+			elif [ "${dir}" == "./UncertaintyQuantification" ];
 			then
 				$SED -i.bak 's/steps=\[1\];/steps=\[1:7\];\n\ntry\n/' $FILE
-			elif [ "${dir}" == "./Data" ];	
+			elif [ "${dir}" == "./Data" ];
 			then
 				echo "Data directory is used by examples. No modifications required."
