[issue16877] Odd behavior of ~ in os.path.abspath and os.path.realpath

2013-01-06 Thread Ian Shields
Ian Shields added the comment: I think that's an excellent resolution to the problem. Thank you. -- ___ Python tracker ___ ___ Python-

[issue16877] Odd behavior of ~ in os.path.abspath and os.path.realpath

2013-01-06 Thread Roundup Robot
Roundup Robot added the comment: New changeset 02e2fa22f8b7 by R David Murray in branch '3.2': #16877: Add mention that shell-style path expansions are not automatic. http://hg.python.org/cpython/rev/02e2fa22f8b7 New changeset 2ff547c165fd by R David Murray in branch '3.3': merge #16877: Add men

[issue16877] Odd behavior of ~ in os.path.abspath and os.path.realpath

2013-01-06 Thread Georg Brandl
Georg Brandl added the comment: LGTM. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org

[issue16877] Odd behavior of ~ in os.path.abspath and os.path.realpath

2013-01-06 Thread R. David Murray
R. David Murray added the comment: Here is a proposed doc patch. While not a necessary doc addition, I do think it provides some useful guidance, and is short enough that it doesn't weigh down the docs. -- keywords: +patch Added file: http://bugs.python.org/file28597/doc_no_default_ex

[issue16877] Odd behavior of ~ in os.path.abspath and os.path.realpath

2013-01-06 Thread Georg Brandl
Georg Brandl added the comment: Both are a kind of command-line expansion, see for example bash(1). Listed there are "brace expansion, tilde expansion, parameter and variable expansion, command substitution, arithmetic expansion, word splitting, and pathname expansion". Python does none of th

[issue16877] Odd behavior of ~ in os.path.abspath and os.path.realpath

2013-01-06 Thread Ian Shields
Ian Shields added the comment: David, Tilde expansion is different to globbing. Globbing in Python doesn't automatically do tilde expansion either. >>> glob.glob("~") [] Looking at the documentation, I don't think it would be practical to add documentation to each affected function - there are

[issue16877] Odd behavior of ~ in os.path.abspath and os.path.realpath

2013-01-06 Thread Ian Shields
Ian Shields added the comment: Oddity may be in the eye of the beholder. I've been programming and scripting for about 40 years, including several *IX shells and many other systems. I'm relatively new to Python. Mostly the results of doing things in Python are what I expect. Not doing expansio

[issue16877] Odd behavior of ~ in os.path.abspath and os.path.realpath

2013-01-06 Thread R. David Murray
R. David Murray added the comment: In addition, as far as I know, ba/sh has no equivalent to os.path.join (see, eg: http://unix.stackexchange.com/questions/23208/building-paths-robustly). So even if we *did* want to "act like the shell" there's no analog to point to. The shell only expands ~

[issue16877] Odd behavior of ~ in os.path.abspath and os.path.realpath

2013-01-06 Thread Georg Brandl
Georg Brandl added the comment: Can you point exactly where the "odd behavior" is? Note that "~" is a normal component for UNIX file/path names, and in such it has no special meaning (as opposed to "/"). This is why it gets no special handling by any Python path functions, except for expandu

[issue16877] Odd behavior of ~ in os.path.abspath and os.path.realpath

2013-01-06 Thread Ian Shields
Ian Shields added the comment: 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) ar

[issue16877] Odd behavior of ~ in os.path.abspath and os.path.realpath

2013-01-05 Thread R. David Murray
R. David Murray added the comment: This is intentional. You have to call expanduser yourself if you want ~ to be expanded. Otherwise it is treated as any other path component would be. I don't understand your final comment, can you clarify? -- nosy: +r.david.murray resolution: -> inv

[issue16877] Odd behavior of ~ in os.path.abspath and os.path.realpath

2013-01-05 Thread Ian Shields
New submission from Ian Shields: 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@