[issue19844] os.path.split fails on windows path
Changes by Hanz Kanst bohemi...@gmail.com: -- components: Windows nosy: Hanz priority: normal severity: normal status: open title: os.path.split fails on windows path type: behavior versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19844 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19844] os.path.split fails on windows path
New submission from Hanz Kanst: os.path.split fails on windows path to reproduce in python 3.3: file = C:\progs\python\test\target\Amy Winehouse\Amy Winehouse - Back To Black (2006)\01 - Rehab.ogg os.path.split(os.path.abspath(file))[0] returns 'C:\\progs\\python\testordner\target\\Amy Winehouse' and os.path.split(os.path.abspath(file))[1] returns 'Amy Winehouse - Back To Black (2006)\x01 - Rehab.ogg' According to the definition the tail should never contain a tail. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19844 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19844] os.path.split fails on windows path
Hanz Kanst added the comment: According to the definition the tail should never contain a slash. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19844 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19844] os.path.split fails on windows path
SilentGhost added the comment: file must be a raw string: file = r'C:\progs\python' Then everthing works. -- nosy: +SilentGhost resolution: - invalid ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19844 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19844] os.path.split fails on windows path
Christian Heimes added the comment: Ah, you fell victim to a classic gotcha. :) Either you have to quote \ with \\ or you have to use a raw string. Withouth a raw string \t is TAB and \01 is the byte \x01: import ntpath fname = rC:\progs\python\test\target\Amy Winehouse\Amy Winehouse - Back To Black (2006)\01 - Rehab.ogg ntpath.split(fname) ('C:\\progs\\python\\test\\target\\Amy Winehouse\\Amy Winehouse - Back To Black (2006)', '01 - Rehab.ogg') len(\01) 1 \01 == chr(1) True len(r\01) 3 -- nosy: +christian.heimes status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19844 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19844] os.path.split fails on windows path
Hanz Kanst added the comment: Hm, how can I handle this if file is an existing string and there is no option to assign raw via r'some\raw\string'? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19844 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19844] os.path.split fails on windows path
R. David Murray added the comment: If it is an existing string, the backslashes are already in the string. The r prefix or the escaping is only required to get the backslashes into a string when you are coding them into a source file. -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19844 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com