[issue15342] os.path.join behavior

Pan Yongzhi report at bugs.python.org
Fri Jul 13 03:45:30 CEST 2012


New submission from Pan Yongzhi <fossilet at users.sourceforge.net>:

I am constructing a source directory argument to rsync. It has to end with slash due to rsync behavior. I use:

os.path.join('/src/dir', os.path.sep)

And run it and realized the source directory becomes '/'. Luckily it is not the destination.

Why should join discard all previous path components if any component is an absoulute path? This is such a surprise and renders this function useless.

----------
messages: 165348
nosy: fossilet
priority: normal
severity: normal
status: open
title: os.path.join behavior
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15342>
_______________________________________


More information about the Python-bugs-list mailing list