This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ibshields
Recipients ibshields, r.david.murray
Date 2013-01-06.17:40:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1357494002.37.0.122527489222.issue16877@psf.upfronthosting.co.za>
In-reply-to
Content
Regarding last comment. I had missed the comment in documentation fo os.path.join "Join one or more path components intelligently. If any component is an absolute path, all previous components (on Windows, including the previous drive letter, if there was one) are thrown away, and joining continues". So the issue is really the behavior of os.path.join where the intelligence in the joining does not recognize that "~" is usually expanded to an absolute path. Consider the following Bash commands:
[ian@attic4 testpath]$ pwd
/home/ian/testpath
[ian@attic4 testpath]$ echo $(cd ~/testpath/..;pwd)
/home/ian
[ian@attic4 testpath]$ cd /home/ian/~
bash: cd: /home/ian/~: No such file or directory

Now consider some Python
>>> os.getcwd()
'/home/ian/testpath'
>>> os.path.join(os.getcwd(), "/home/ian")
'/home/ian'
>>> os.path.expanduser("~")
'/home/ian'
>>> os.path.join(os.getcwd(), "~")
'/home/ian/testpath/~'
>>> os.path.expanduser(os.path.abspath("~"))
'/home/ian/testpath/~'
>>> os.path.abspath(os.path.expanduser("~"))
'/home/ian'

I find the Python behavior rather odd. I cna live with it now I know about it, but if it is really intentional it would help to document this rather odd behavior somewhat better.
History
Date User Action Args
2013-01-06 17:40:02ibshieldssetrecipients: + ibshields, r.david.murray
2013-01-06 17:40:02ibshieldssetmessageid: <1357494002.37.0.122527489222.issue16877@psf.upfronthosting.co.za>
2013-01-06 17:40:02ibshieldslinkissue16877 messages
2013-01-06 17:40:02ibshieldscreate