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
1 changed files with 3 additions and 1 deletions

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,