fix crash on macOS when opening OpenSCAD Workbench

The OpenSCAD Workbench crashes on open on macOS with error
"a bytes-like object is required, not 'str'", due to python 2 to
python 3 incompatibility. This is me implementing the fix described by
oapa at
https://forum.freecadweb.org/viewtopic.php?t=35384#p311908 (with an
untested attempt to make it also still run with python 2).
This commit is contained in:
Matthew Fallshaw
2019-10-04 17:48:24 -07:00
committed by wmayer
parent 38447e4dd2
commit a2a15c5cd4

View File

@@ -77,7 +77,7 @@ def searchforopenscadexe():
stdout=subprocess.PIPE,stderr=subprocess.PIPE)
stdout,stderr = p1.communicate(ascript)
if p1.returncode == 0:
opathl=stdout.split('\n')
opathl = stdout.decode().split('\n') if sys.version_info.major >= 3 else stdout.split('\n')
if len(opathl) >=1:
return opathl[0]+'Contents/MacOS/OpenSCAD'
#test the default path