##// END OF EJS Templates
Use sys.path to make filename in traceback absolute
Jeroen Demeyer -
Show More
@@ -722,15 +722,23 b' class VerboseTB(TBTools):'
722 #print '*** record:',file,lnum,func,lines,index # dbg
722 #print '*** record:',file,lnum,func,lines,index # dbg
723 if not file:
723 if not file:
724 file = '?'
724 file = '?'
725 elif not (file.startswith(str("<")) and file.endswith(str(">"))):
725 elif file.startswith(str("<")) and file.endswith(str(">")):
726 # Guess that filenames like <string> aren't real filenames, so
726 # Not a real filename, no problem...
727 # don't call abspath on them.
727 pass
728 try:
728 elif not os.path.isabs(file):
729 file = abspath(file)
729 # Try to make the filename absolute by trying all
730 except OSError:
730 # sys.path entries (which is also what linecache does)
731 # Not sure if this can still happen: abspath now works with
731 for dirname in sys.path:
732 # file names like <string>
732 try:
733 pass
733 fullname = os.path.join(dirname, file)
734 if os.path.isfile(fullname):
735 file = os.path.abspath(fullname)
736 break
737 except Exception:
738 # Just in case that sys.path contains very
739 # strange entries...
740 pass
741
734 file = py3compat.cast_unicode(file, util_path.fs_encoding)
742 file = py3compat.cast_unicode(file, util_path.fs_encoding)
735 link = tpl_link % file
743 link = tpl_link % file
736 args, varargs, varkw, locals = inspect.getargvalues(frame)
744 args, varargs, varkw, locals = inspect.getargvalues(frame)
General Comments 0
You need to be logged in to leave comments. Login now