[New-bugs-announce] [issue31289] File paths in exception traceback resolve symlinks
report at bugs.python.org
Sun Aug 27 16:17:56 EDT 2017
New submission from Paul Pinterits:
The file paths displayed in exception tracebacks have their symlinks resolved. I would prefer if the "original" path could be displayed instead, because resolved symlinks result in unexpected paths in the traceback and can be quite confusing.
rawing at localhost ~> cat test_scripts/A.py
rawing at localhost ~> cat test_scripts/B.py
rawing at localhost ~> ln -s test_scripts test_symlink
rawing at localhost ~> python3 test_symlink/A.py
Traceback (most recent call last):
File "test_symlink/A.py", line 2, in <module>
File "/home/rawing/test_scripts/B.py", line 2, in throw
As you can see, even though both scripts reside in the same directory, the file paths displayed in the traceback look very different. At first glance, it looks like B is in a completely different place than A.
Furthermore, this behavior tends to trip up IDEs - PyCharm for example does not understand that test_scripts/B.py and test_symlink/B.py are the same file, so I end up having the same file opened in two different tabs.
Would it be possible to change this behavior and have "/home/rawing/test_symlink/B.py" show up in the traceback instead?
components: Interpreter Core
nosy: Paul Pinterits
title: File paths in exception traceback resolve symlinks
versions: Python 2.7, Python 3.6
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce