diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 392632ea..f5669b58 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -97,5 +97,5 @@ repos: hooks: - id: vermin # specify your target version here, OR in a Vermin config file as usual: - args: ['-t=2.7', '-t=3.7-', '--violations'] + args: ['-t=3.7-', '--violations'] # (if your target is specified in a Vermin config, you may omit the 'args' entry entirely) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ab9891b..e727a13c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `default_file_id`: can be used to create numbered PNGs - `fixed_auto_camera`: to avoid adjusting the automatic camera on each frame - Camera option to set the clip start (#484) + - Traceback dump when Blender output contains it - Populate: - Basic support for regular list items (#480) - Help for the error levels diff --git a/kibot/out_blender_export.py b/kibot/out_blender_export.py index 42b6d7f4..7fc3c635 100644 --- a/kibot/out_blender_export.py +++ b/kibot/out_blender_export.py @@ -14,11 +14,12 @@ Dependencies: import json import os import re +import sys from tempfile import NamedTemporaryFile, TemporaryDirectory from .error import KiPlotConfigurationError from .kiplot import get_output_targets, run_output, run_command, register_xmp_import, config_output, configure_and_run from .gs import GS -from .misc import MISSING_TOOL +from .misc import MISSING_TOOL, BLENDER_ERROR from .optionable import Optionable, BaseOptions from .out_base_3d import Base3D, Base3DOptionsWithHL from .registrable import RegOutput @@ -535,6 +536,11 @@ class Blender_ExportOptions(BaseOptions): raise KiPlotConfigurationError('Missing '+pcb3d_file) return pcb3d_file + def analyze_errors(self, msg): + if 'Traceback ' in msg: + logger.error('Error from Blender run:\n'+msg[msg.index('Traceback '):]) + sys.exit(BLENDER_ERROR) + def run(self, output): if GS.ki5: logger.error("`blender_export` needs KiCad 6+") @@ -638,7 +644,7 @@ class Blender_ExportOptions(BaseOptions): cmd.extend(['--scene', f.name]) cmd.append(pcb3d_file) # Execute the command - run_command(cmd) + self.analyze_errors(run_command(cmd)) if self.render_options.auto_crop: for pov in self.point_of_view: for o in self.outputs: