[issue27228] just for clearing: os.path.normpath("file://a") returns "file:/a"

New submission from Arno-Can Uestuensoez: I am currently finishing a file system library and use 'os.path.normpath' for canonical input into match-operations. So already found Issue26329 - IEEE-1003.1-Chap 4.2 and written a comment. But I guess this issue should be handled seperately. Now have to deal by myself with the eventual prefix 'file://' for input, and guess it should be supported. I did not found a statement on this case, so issue this for clarification. The 'os.path.normpath' call simply replaces subsequent os.sep, when they are not leading as 1003.1 states. But how should the following examples be handled: file:////a => /a OR //a ??? file://///a => /a OK file:///a => /a OK ---------- assignee: docs@python components: Documentation messages: 267407 nosy: Fred Rolland, Winterflower, acue, docs@python, ebarry, lemburg, serhiy.storchaka priority: normal severity: normal status: open title: just for clearing: os.path.normpath("file://a") returns "file:/a" type: behavior versions: Python 2.7 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27228> _______________________________________

Steven D'Aprano added the comment: "file://a" is a valid relative file path, for a directory called "file:" and a file called "a", so normpath should return "file:/a". ---------- nosy: +steven.daprano _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27228> _______________________________________

Georg Brandl added the comment: `os.path` does not handle URIs of any type, so this behavior is correct as Steven says. ---------- nosy: +georg.brandl resolution: -> not a bug status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27228> _______________________________________
participants (3)
-
Arno-Can Uestuensoez
-
Georg Brandl
-
Steven D'Aprano