[docs] Found a bug in the os.path.join function
Ryan McCafferty
ryano.mcc13 at gmail.com
Thu Dec 10 19:30:57 EST 2015
Hello,
I am running python v3.4.2 on a Raspberry Pi 2 running raspbian jesse. I
found what I think is a bug with the os.path.join function. When passing
multiple arguments to this function, which is usually the case, if any of
the arguments contain a leading slash, all of the arguments that come
before the one with the leading slash get truncated from the resulting path.
>>> os.path.join('a', 'b', 'c')
'a/b/c' # this is expected
>>> os.path.join('a', '/b', 'c')
'/b/c' # expecting a/b/c
>>> os.path.join('a', 'b', '/c')
'/c' # expecting a/b/c
>>> os.path.join('a', '/b', '/c')
'/c' # expecting a/b/c
I think this is a bug, because I believe the reasoning for these path join
functions is so users do not have to worry about which path components
contain leading or trailing slashes.
Thank you,
Ryan McCafferty
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20151210/be0c72b8/attachment.html>
More information about the docs
mailing list