[issue1495754] os.listdir(): inconsistent behavior with trailing spaces

Eric Fahlgren report at bugs.python.org
Wed Jun 28 16:59:25 EDT 2017


Eric Fahlgren added the comment:

Would it be appropriate to make a comment about this Windows bug in both os.stat and os.path.exists documentation?  I just stumbled upon it independently (both Win7 and 10, both Py 2.7 and 3.6) with nearly the same incantation that Kenneth reported over 10 years ago (exists check success, followed by scandir failure).

[My workaround was to append os.sep to the directory spec:
  os.path.exists(newdir+os.sep) -> False
]

Clearly this behavior is not going away, so it should at least be mentioned somewhere more prominently than on a decade old BPO item...

----------
nosy: +eric.fahlgren

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


More information about the Python-bugs-list mailing list