[issue43620] os.path.join does not use os.sep as documentation claims

Eryk Sun report at bugs.python.org
Thu Mar 25 15:20:59 EDT 2021


Eryk Sun <eryksun at gmail.com> added the comment:

Fred, do you think this needs to be reopened to clarify that os.sep and os.altsep are not parameters for the ntpath and posixpath modules? 

I would have thought that the note at the top (path name conventions, etc) would be sufficient to let someone know that os.path is meant for working with paths on the current platform. Working with Windows paths in POSIX, and vice versa, is not simply a matter of replacing os.sep. For example:

    >>> posixpath.join('C:/spam', '/eggs')
    '/eggs'
    >>> ntpath.join('C:/spam', '/eggs')
    'C:/eggs'

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43620>
_______________________________________


More information about the Python-bugs-list mailing list