Message179170
Filespecs that start with ~ are not properly handled by os.path.realpath or os.path.abspath (and maybe other functions). Following console output from Fedora 17 using Puthon 3.2 illustrates the issue. Similar issue in 2.7
[ian@attic4 developerworks]$ cd ..
[ian@attic4 ~]$ mkdir testpath
[ian@attic4 ~]$ cd testpath
[ian@attic4 testpath]$ pwd
/home/ian/testpath
[ian@attic4 testpath]$ python3
Python 3.2.3 (default, Jun 8 2012, 05:36:09)
[GCC 4.7.0 20120507 (Red Hat 4.7.0-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.path.abspath("~")
'/home/ian/testpath/~'
>>> os.path.realpath("~/xxx/zzz")
'/home/ian/testpath/~/xxx/zzz'
>>> os.path.abspath("~/..")
'/home/ian/testpath'
Function should probably use expanduser to determine if path is already absolute. Documentation at http://docs.python.org/3/library/os.path.html is also misleading as this is not how these functions work if given an absolute path to start with. |
|
Date |
User |
Action |
Args |
2013-01-06 04:25:15 | ibshields | set | recipients:
+ ibshields |
2013-01-06 04:25:15 | ibshields | set | messageid: <1357446315.42.0.750501561867.issue16877@psf.upfronthosting.co.za> |
2013-01-06 04:25:15 | ibshields | link | issue16877 messages |
2013-01-06 04:25:14 | ibshields | create | |
|