2
0
mirror of https://github.com/m-labs/artiq.git synced 2025-01-19 15:16:41 +08:00

ARTIQException: replace ARTIQ library path with <artiq> in tracebacks.

This commit is contained in:
whitequark 2015-08-28 04:55:46 -05:00
parent 79af228af3
commit 5916c10b24

View File

@ -2,7 +2,7 @@
Core ARTIQ extensions to the Python language. Core ARTIQ extensions to the Python language.
""" """
import linecache, re import os, linecache, re
from collections import namedtuple from collections import namedtuple
from functools import wraps from functools import wraps
@ -394,6 +394,8 @@ class ARTIQException(Exception):
else: else:
formatted_address = " (RA=0x{:x})".format(address) formatted_address = " (RA=0x{:x})".format(address)
filename = filename.replace(os.path.normpath(os.path.join(os.path.dirname(__file__),
"..")), "<artiq>")
if column == -1: if column == -1:
lines.append(" File \"{file}\", line {line}, in {function}{address}". lines.append(" File \"{file}\", line {line}, in {function}{address}".
format(file=filename, line=line, function=function, format(file=filename, line=line, function=function,