Index: /issm/trunk-jpl/src/m/mesh/planet/gmsh/gmshplanet.m
===================================================================
--- /issm/trunk-jpl/src/m/mesh/planet/gmsh/gmshplanet.m	(revision 27173)
+++ /issm/trunk-jpl/src/m/mesh/planet/gmsh/gmshplanet.m	(revision 27174)
@@ -14,4 +14,20 @@
 %      md.mesh=gmshplanet('radius',6000,'resolution',100);
 %      md.mesh=gmshplanet('radius',6000,'resolution',100);
+
+	%Find path to gmsh
+	paths = {[issmdir() 'bin/gmsh'],...
+		 [issmdir() 'externalpackages/gmsh/install/gmsh'],...
+		 ['/usr/bin/gmsh']...
+		};
+	gmshpath = '';
+	for i=paths
+		if exist(i{1},'file'),
+			gmshpath = i{1};
+			break;
+		end
+	end
+	if isempty(gmshpath),
+		error('gmsh not found, make sure it is properly installed');
+	end
 
 	% Get Gmsh version
@@ -51,9 +67,9 @@
 
 	% NOTE:
-	% - The default format in Gmsh 3 is "msh2". Rather than conditionally 
-	% modifying our parsing scheme for Gmsh 4, for now, we simply set the 
+	% - The default format in Gmsh 3 is "msh2". Rather than conditionally
+	% modifying our parsing scheme for Gmsh 4, for now, we simply set the
 	% 'Mesh.MshFileVersion' option.
-	% - Decreasing the value of the 'Mesh.RandomFactor' option leads to an 
-	% equal number of nodes and elements being produced under macOS and Linux 
+	% - Decreasing the value of the 'Mesh.RandomFactor' option leads to an
+	% equal number of nodes and elements being produced under macOS and Linux
 	% at certain resolutions using certain meshing algorithms.
 	%
@@ -142,4 +158,9 @@
 
 	% Call gmsh
+	%
+	% NOTE: The default format in Gmsh 3 is "msh2". Rather than conditionally
+	%		modifying our parsing scheme for Gmsh 4, for now, we simply set the
+	%		"-format" option.
+	%
 	if  exist(options,'refine'),
 		system(['gmsh -2 sphere.geo -bgm sphere.pos']);
@@ -195,9 +216,9 @@
 	%}}}
 
-	%a little technicality here. the mesh generate is not exactly on the 
-	%sphere. we create lat,long coordinates, and reproject on an exact sphere. 
+	%a little technicality here. the mesh generate is not exactly on the
+	%sphere. we create lat,long coordinates, and reproject on an exact sphere.
 	mesh.r=sqrt(mesh.x.^2+mesh.y.^2+mesh.z.^2);
 
-	%make sure we don't have south and north pole: 
+	%make sure we don't have south and north pole:
 	pos=find(mesh.x==0 & mesh.y==0);
 	mesh.lat = asind(mesh.z./mesh.r);
Index: /issm/trunk-jpl/src/m/mesh/planet/gmsh/gmshplanet.py
===================================================================
--- /issm/trunk-jpl/src/m/mesh/planet/gmsh/gmshplanet.py	(revision 27173)
+++ /issm/trunk-jpl/src/m/mesh/planet/gmsh/gmshplanet.py	(revision 27174)
@@ -26,5 +26,9 @@
     subproc = subprocess.Popen(subproc_args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
     outs, errs = subproc.communicate()
-    if ((not isinstance(errs, bytes)) & (errs != '')) or (isinstance(errs, bytes) & (errs.decode() != '')):
+    try:
+        strErrs = errs.decode()
+    except AttributeError:  #this is not a byte variable, let's assume string
+        strErrs = errs
+    if strErrs != '':
         raise Exception('gmshplanet: call to gmsh failed: {}'.format(errs))
     gmshmajorversion = int(outs)
