added error handling from ODA File converter and fixed issues with ezdxf and matplotlib
This commit is contained in:
parent
1979f163b4
commit
82294d5540
@ -33,8 +33,8 @@ from subprocess import Popen, PIPE
|
|||||||
import shutil
|
import shutil
|
||||||
from shutil import which
|
from shutil import which
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
#from mimetypes import MimeTypes
|
from mimetypes import MimeTypes
|
||||||
#import urllib.request as urllib
|
import urllib.request as urllib
|
||||||
|
|
||||||
#ezdxf related imports
|
#ezdxf related imports
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
@ -226,8 +226,18 @@ class DXFDWGImport(inkex.Effect):
|
|||||||
inkex.utils.debug("ODAFileConverter failed: %d %s %s" % (proc.returncode, stdout, stderr))
|
inkex.utils.debug("ODAFileConverter failed: %d %s %s" % (proc.returncode, stdout, stderr))
|
||||||
if os.name != 'nt':
|
if os.name != 'nt':
|
||||||
inkex.utils.debug("If the error message above contains a warning about wrong/missing Qt version please install the required version. You can get the installer from 'https://download.qt.io/archive/qt/'. Sadly you will need to create a free account to install. After installation please configure the shell script '/usr/bin/ODAFileConverter' to add a preceding line with content similar to 'LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/Qt5.14.2/5.14.2/gcc_64/lib/'.")
|
inkex.utils.debug("If the error message above contains a warning about wrong/missing Qt version please install the required version. You can get the installer from 'https://download.qt.io/archive/qt/'. Sadly you will need to create a free account to install. After installation please configure the shell script '/usr/bin/ODAFileConverter' to add a preceding line with content similar to 'LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/Qt5.14.2/5.14.2/gcc_64/lib/'.")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
# check if ODA converted successfully. This is the case if no error file was created
|
||||||
|
oda_errorfile = os.path.join(temp_output_dir, Path(inputfile).name + ".err")
|
||||||
|
if os.path.exists(oda_errorfile):
|
||||||
|
inkex.utils.debug("ODA File Converter failed to process the file. Cannot continue DXF/DWG import. The error message is:")
|
||||||
|
errormessage = open(oda_errorfile, 'r')
|
||||||
|
errorlines = errormessage.readlines()
|
||||||
|
for errorline in errorlines:
|
||||||
|
inkex.utils.debug(errorline.strip())
|
||||||
|
errormessage.close()
|
||||||
|
exit(1)
|
||||||
|
|
||||||
# Do some movings/copies of skipped or processed DXF
|
# Do some movings/copies of skipped or processed DXF
|
||||||
if self.options.oda_skip_dxf_to_dxf: #if true we need to move the file to simulate "processed"
|
if self.options.oda_skip_dxf_to_dxf: #if true we need to move the file to simulate "processed"
|
||||||
shutil.move(os.path.join(temp_input_dir, Path(inputfile).name), os.path.join(temp_output_dir, Path(inputfile).name))
|
shutil.move(os.path.join(temp_input_dir, Path(inputfile).name), os.path.join(temp_output_dir, Path(inputfile).name))
|
||||||
|
Reference in New Issue
Block a user