Gmsh path detection fix for Python3 on Linux

This commit is contained in:
Pawel Bogut
2018-04-03 21:55:48 +02:00
committed by wmayer
parent 77512c0266
commit 839cef928b

View File

@@ -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)