From 839cef928b6ba0badbcf3510f4d26d41f71e989a Mon Sep 17 00:00:00 2001 From: Pawel Bogut Date: Tue, 3 Apr 2018 21:55:48 +0200 Subject: [PATCH] Gmsh path detection fix for Python3 on Linux --- src/Mod/Fem/femmesh/gmshtools.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Mod/Fem/femmesh/gmshtools.py b/src/Mod/Fem/femmesh/gmshtools.py index 251255cc49..886e5c4db2 100644 --- a/src/Mod/Fem/femmesh/gmshtools.py +++ b/src/Mod/Fem/femmesh/gmshtools.py @@ -34,6 +34,7 @@ from FreeCAD import Units import subprocess import tempfile from platform import system +import sys class GmshTools(): @@ -220,7 +221,10 @@ class GmshTools(): elif system() == "Linux": p1 = subprocess.Popen(['which', 'gmsh'], stdout=subprocess.PIPE) if p1.wait() == 0: - gmsh_path = p1.stdout.read().split('\n')[0] + output = p1.stdout.read() + if sys.version_info.major >= 3: + output = output.decode('utf-8') + gmsh_path = output.split('\n')[0] elif p1.wait() == 1: error_message = "Gmsh binary gmsh not found in standard system binary path. Please install Gmsh or set path to binary in FEM preferences tab Gmsh.\n" FreeCAD.Console.PrintError(error_message)