Trueimport os.path
os.path.isabs('/home/..')
'/'os.path.abspath('/home/..')
When an exception occurs, the full path to the file from which it
originates is displayed, but redundant elements are not removed. For instance:
$ ./python ./foo
Traceback (most recent call last):
File "/home/User/cpython/./foo", line 4, in <module>
a()
File "/home/User/cpython/./foo", line 3, in a
def a(): raise ValueError
ValueError
This happens because the function _Py_abspath (in Python/fileutils.c)
appends relative_path_to_file to absolute_path_to_current_working_directory. Not sure if this should be treated as a bug, because the definition of 'absolute path' is not clear. Does it mean a path starting from the root directory, or a path without redundant elements?
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 546 |
Nodes: | 16 (2 / 14) |
Uptime: | 12:29:31 |
Calls: | 10,389 |
Calls today: | 4 |
Files: | 14,061 |
Messages: | 6,416,878 |
Posted today: | 1 |