[issue16413] Non cross-platform behavior of os.path.split

New submission from anatoly techtonik: os.path.split('c:foo') gives ('c:', 'foo') on Windows and ('', 'c:foo') on Linux, which is not documented. IIUC, the behavior change in os module is not possible, so a documentation note will be appreciated. ---------- assignee: docs@python components: Documentation, Library (Lib) messages: 174890 nosy: docs@python, techtonik priority: normal severity: normal status: open title: Non cross-platform behavior of os.path.split versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue16413> _______________________________________

Serhiy Storchaka added the comment: .. note:: Since different operating systems have different path name conventions, there are several versions of this module in the standard library. The :mod:`os.path` module is always the path module suitable for the operating system Python is running on, and therefore usable for local paths. However, you can also import and use the individual modules if you want to manipulate a path that is *always* in one of the different formats. They all have the same interface: * :mod:`posixpath` for UNIX-style paths * :mod:`ntpath` for Windows paths * :mod:`macpath` for old-style MacOS paths ---------- nosy: +serhiy.storchaka resolution: -> invalid _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue16413> _______________________________________

Changes by R. David Murray <rdmurray@bitdance.com>: ---------- stage: -> committed/rejected status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue16413> _______________________________________

anatoly techtonik added the comment: Historically os.path.split() on Windows is able to grok UNIX paths easily. Don't you think that Python language reference for the os.path should include less vague definition of Windows, UNIX-style and old-style MacOS paths it works with? ---------- resolution: invalid -> status: closed -> open _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue16413> _______________________________________

anatoly techtonik added the comment: User story: as a Python programmer working with different systems, I'd like to know how os.path module threats paths on these systems. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue16413> _______________________________________

Georg Brandl added the comment: Please submit a patch. ---------- nosy: +georg.brandl _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue16413> _______________________________________

anatoly techtonik added the comment: I don't know about the differences. An expert is required. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue16413> _______________________________________

Serhiy Storchaka added the comment: I don't think that Python should include documentation on all supported OSes, formats, protocols and algorithms. There are documentation outside Python. I think this is not Python issue. ---------- status: open -> pending _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue16413> _______________________________________

Changes by Serhiy Storchaka <storchaka@gmail.com>: ---------- resolution: -> invalid status: pending -> closed _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue16413> _______________________________________

Serhiy Storchaka added the comment: .. note:: Since different operating systems have different path name conventions, there are several versions of this module in the standard library. The :mod:`os.path` module is always the path module suitable for the operating system Python is running on, and therefore usable for local paths. However, you can also import and use the individual modules if you want to manipulate a path that is *always* in one of the different formats. They all have the same interface: * :mod:`posixpath` for UNIX-style paths * :mod:`ntpath` for Windows paths * :mod:`macpath` for old-style MacOS paths ---------- nosy: +serhiy.storchaka resolution: -> invalid _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue16413> _______________________________________

Changes by R. David Murray <rdmurray@bitdance.com>: ---------- stage: -> committed/rejected status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue16413> _______________________________________

anatoly techtonik added the comment: Historically os.path.split() on Windows is able to grok UNIX paths easily. Don't you think that Python language reference for the os.path should include less vague definition of Windows, UNIX-style and old-style MacOS paths it works with? ---------- resolution: invalid -> status: closed -> open _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue16413> _______________________________________

anatoly techtonik added the comment: User story: as a Python programmer working with different systems, I'd like to know how os.path module threats paths on these systems. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue16413> _______________________________________

Georg Brandl added the comment: Please submit a patch. ---------- nosy: +georg.brandl _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue16413> _______________________________________

anatoly techtonik added the comment: I don't know about the differences. An expert is required. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue16413> _______________________________________

Serhiy Storchaka added the comment: I don't think that Python should include documentation on all supported OSes, formats, protocols and algorithms. There are documentation outside Python. I think this is not Python issue. ---------- status: open -> pending _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue16413> _______________________________________

Changes by Serhiy Storchaka <storchaka@gmail.com>: ---------- resolution: -> invalid status: pending -> closed _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue16413> _______________________________________
participants (4)
-
anatoly techtonik
-
Georg Brandl
-
R. David Murray
-
Serhiy Storchaka