Permalink
Browse files

Fix for displaying variables in verbose traceback.

  • Loading branch information...
takluyver committed May 9, 2012
1 parent cb19d0d commit 9f6601dccb8dc284c75f95f4ac34254f70dc2e30
Showing with 13 additions and 7 deletions.
  1. +13 −7 IPython/core/ultratb.py
View
@@ -786,13 +786,19 @@ def nullrepr(value, repr=text_repr): return ''
abspath = os.path.abspath
for frame, file, lnum, func, lines, index in records:
#print '*** record:',file,lnum,func,lines,index # dbg
- try:
- file = file and abspath(file) or '?'
- except OSError:
- # if file is '<console>' or something not in the filesystem,
- # the abspath call will throw an OSError. Just ignore it and
- # keep the original file string.
- pass
+
+ if not file:
+ file = '?'
+ elif not(file.startswith("<") and file.endswith(">")):
+ # Guess that filenames like <string> aren't real filenames, so
+ # don't call abspath on them.
+ try:
+ file = abspath(file)
+ except OSError:
+ # Not sure if this can still happen: abspath now works with
+ # file names like <string>
+ pass
+
link = tpl_link % file
args, varargs, varkw, locals = inspect.getargvalues(frame)

0 comments on commit 9f6601d

Please sign in to comment.