##// 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 722 #print '*** record:',file,lnum,func,lines,index # dbg
723 723 if not file:
724 724 file = '?'
725 elif not (file.startswith(str("<")) and file.endswith(str(">"))):
726 # Guess that filenames like <string> aren't real filenames, so
727 # don't call abspath on them.
725 elif file.startswith(str("<")) and file.endswith(str(">")):
726 # Not a real filename, no problem...
727 pass
728 elif not os.path.isabs(file):
729 # Try to make the filename absolute by trying all
730 # sys.path entries (which is also what linecache does)
731 for dirname in sys.path:
728 732 try:
729 file = abspath(file)
730 except OSError:
731 # Not sure if this can still happen: abspath now works with
732 # file names like <string>
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...
733 740 pass
741
734 742 file = py3compat.cast_unicode(file, util_path.fs_encoding)
735 743 link = tpl_link % file
736 744 args, varargs, varkw, locals = inspect.getargvalues(frame)
General Comments 0
You need to be logged in to leave comments. Login now