Index: /issm/trunk-jpl/src/m/mesh/planet/gmsh/gmshplanet.m
===================================================================
--- /issm/trunk-jpl/src/m/mesh/planet/gmsh/gmshplanet.m	(revision 27631)
+++ /issm/trunk-jpl/src/m/mesh/planet/gmsh/gmshplanet.m	(revision 27632)
@@ -1,4 +1,4 @@
 function mesh=gmshplanet(varargin)
-%GMSHPLANET - mesh generation for a sphere. Very specific code for gmsh from $ISSM_DIR/src/demos/simple_geo/sphere.geo
+%GMSHPLANET - mesh generation for a sphere. Very specific code for Gmsh from $ISSM_DIR/src/demos/simple_geo/sphere.geo
 %
 %   Available options (for more details see ISSM website http://issm.jpl.nasa.gov/):
@@ -16,15 +16,15 @@
 
 	%Find path to gmsh
-	paths = {
-		[getenv('ISSM_EXT_DIR') '/shared/gmsh/install/bin/gmsh'],...
-		[getenv('ISSM_EXT_DIR') '/static/gmsh/install/bin/gmsh'],...
-		[getenv('ISSM_EXT_DIR') '/gmsh/install/bin/gmsh'],...
-		[issmdir() 'externalpackages/gmsh/install/bin/gmsh'],...
-		[issmdir() 'bin/gmsh'],...
-		['/usr/bin/gmsh']...
+	paths={
+		[getenv('ISSM_EXT_DIR') '/shared/gmsh/install/bin'],...
+		[getenv('ISSM_EXT_DIR') '/static/gmsh/install/bin'],...
+		[getenv('ISSM_EXT_DIR') '/gmsh/install/bin'],...
+		[issmdir() '/externalpackages/gmsh/install/bin'],...
+		[issmdir() '/bin'],...
+		['/usr/bin']...
 	};
-	gmshpath = '';
+	gmshpath='';
 	for i=paths
-		if exist(i{1},'file'),
+		if exist([i{1} '/gmsh'],'file'),
 			gmshpath = i{1};
 			break;
@@ -32,6 +32,8 @@
 	end
 	if isempty(gmshpath),
-		error('Gmsh not found, make sure it is properly installed');
-	end
+		error('gmshplanet: gmsh executable not found!');
+	end
+
+	setenv('PATH', [gmshpath ':' getenv('PATH')]);
 
 	% Get Gmsh version
@@ -39,15 +41,4 @@
 	if s~=0 || contains(r, 'dyld'),
 		error(['gmshplanet: ' r]);
-	elseif isempty(r),
-		% If this function is called from one of our distributable packages, we 
-		% need to do a bit more to find the Gmsh executable
-		[filepath,name,ext]=fileparts(which('gmsh.'));
-		setenv('PATH',[filepath ':' getenv('PATH')]);
-		[s,r]=system(['gmsh -info | command grep ''Version'' | sed -e ''s/Version[[:blank:]]*:[[:blank:]]//'' | cut -d ''.'' -f1']);
-		if s~=0 || contains(r, 'dyld'),
-			error(['gmshplanet: ' r]);
-		elseif isempty(r),
-			error('gmshplanet: Gmsh executable not found!');
-		end
 	end
 	gmshmajorversion=str2num(r);
Index: /issm/trunk-jpl/src/m/mesh/planet/gmsh/gmshplanet.py
===================================================================
--- /issm/trunk-jpl/src/m/mesh/planet/gmsh/gmshplanet.py	(revision 27631)
+++ /issm/trunk-jpl/src/m/mesh/planet/gmsh/gmshplanet.py	(revision 27632)
@@ -1,4 +1,6 @@
+import os
 import subprocess
 import numpy as np
+from issmdir import issmdir
 from MatlabFuncs import *
 from mesh3dsurface import *
@@ -7,5 +9,5 @@
 
 def gmshplanet(*args):
-    """GMSHPLANET - mesh generation for a sphere. Very specific code for gmsh from $ISSM_DIR/src/demos/simple_geo/sphere.geo
+    """gmshplanet - mesh generation for a sphere. Very specific code for Gmsh from $ISSM_DIR/src/demos/simple_geo/sphere.geo
 
     Available options (for more details see ISSM website http://issm.jpl.nasa.gov/):
@@ -21,4 +23,23 @@
         md.mesh = gmshplanet('radius', 6000, 'resolution', 100);
     """
+
+    # Find path to gmsh
+    paths = [
+        os.environ.get('ISSM_EXT_DIR') + '/shared/gmsh/install/bin',
+        os.environ.get('ISSM_EXT_DIR') + '/static/gmsh/install/bin',
+        os.environ.get('ISSM_EXT_DIR') + '/gmsh/install/bin',
+        issmdir() + '/externalpackages/gmsh/install/bin',
+        issmdir() + '/bin',
+        '/usr/bin'
+    ]
+    gmshpath = ''
+    for path in paths:
+        if exists(path + '/gmsh'):
+            gmshpath = path
+            break
+    if gmshpath == '':
+        error('gmshplanet: gmsh executable not found!')
+
+    os.environ['PATH'] = gmshpath ':' os.environ.get['PATH']
 
     # Get Gmsh version
@@ -195,5 +216,5 @@
 
     # A little technicality here. The mesh is not exactly on the sphere. We
-    # create lat,long coordiantes, and reproject onto an exact sphere.
+    # create lat,long coordinates, and reproject onto an exact sphere.
     mesh.r = np.sqrt(mesh.x ** 2 + mesh.y ** 2 + mesh.z ** 2)
 
