From ed236eb7f262e047d0050807675cd964930a949e Mon Sep 17 00:00:00 2001 From: whitequark Date: Fri, 28 Aug 2015 01:54:51 -0500 Subject: [PATCH] artiq_run: pretty-print diagnostics. --- artiq/frontend/artiq_run.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/artiq/frontend/artiq_run.py b/artiq/frontend/artiq_run.py index 069a3358c..600275368 100755 --- a/artiq/frontend/artiq_run.py +++ b/artiq/frontend/artiq_run.py @@ -12,9 +12,10 @@ import h5py from artiq.language.environment import EnvExperiment from artiq.protocols.file_db import FlatFileDB from artiq.master.worker_db import DeviceManager, ResultDB -from artiq.tools import * +from artiq.coredevice.core import CompileError from artiq.compiler.embedding import ObjectMap from artiq.compiler.targets import OR1KTarget +from artiq.tools import * logger = logging.getLogger(__name__) @@ -122,6 +123,11 @@ def run(with_file=False): exp_inst.prepare() exp_inst.run() exp_inst.analyze() + except CompileError as error: + message = "\n".join(error.__cause__.diagnostic.render(colored=True)) + message = message.replace(os.path.normpath(os.path.join(os.path.dirname(__file__), "..")), + "") + print(message, file=sys.stderr) finally: dmgr.close_devices()