Merge pull request #4930 from Kawashima-Azumi/shutil-no-which

Draft: Some shutil don't have the .which method.
This commit is contained in:
Yorik van Havre
2021-08-02 15:41:02 +02:00
committed by GitHub

View File

@@ -203,14 +203,15 @@ def convertToDxf(dwgfilename):
"""
import os, tempfile, subprocess, sys
import shutil
if shutil.which("dwg2dxf"):
try:
outdir = tempfile.mkdtemp()
basename = os.path.basename(dwgfilename)
result = outdir + os.sep + os.path.splitext(basename)[0] + ".dxf"
proc = subprocess.Popen(("dwg2dxf", dwgfilename, "-o", result))
proc.communicate()
return result
except:
pass
teigha = getTeighaConverter()
if teigha: