classification
Title: docs: os.path.commonpath raises ValueError for different drives
Type: enhancement Stage: needs patch
Components: Documentation Versions: Python 3.8, Python 3.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Windson Yang, docs@python, lazka, pjartman
Priority: normal Keywords: easy

Created on 2019-04-21 09:09 by lazka, last changed 2019-05-13 00:25 by Windson Yang.

Messages (3)
msg340604 - (view) Author: Christoph Reiter (lazka) * Date: 2019-04-21 09:09
Since I just got bit by this despite reading the docs:

https://docs.python.org/3.8/library/os.path.html#os.path.commonpath

It lists various error cases where ValueError is raised but is missing the case where absolute paths on Windows are on different drives and I forgot to handle that:

  File "C:/building/msys64/mingw64/lib/python3.7\ntpath.py", line 631, in commonpath
    raise ValueError("Paths don't have the same drive")
ValueError: Paths don't have the same drive
msg340756 - (view) Author: Patrick Artman (pjartman) Date: 2019-04-24 02:54
If this isn't taken I'd be happy to give it a go as my first contribution
msg342273 - (view) Author: Windson Yang (Windson Yang) * Date: 2019-05-13 00:25
An easy fix would be 

"Raise ValueError if paths contain (note: use contain instead of contains) both absolute and relative pathnames or the path are on the different drives."
History
Date User Action Args
2019-05-13 00:25:44Windson Yangsetnosy: + Windson Yang
messages: + msg342273
2019-04-24 02:54:29pjartmansetnosy: + pjartman
messages: + msg340756
2019-04-21 10:16:07serhiy.storchakasetkeywords: + easy
stage: needs patch
versions: + Python 3.7
2019-04-21 09:09:18lazkacreate