Title: os.path.ismount sometimes raises FileNotFoundError on Windows
Type: behavior Stage: test needed
Components: Windows Versions: Python 3.9, Python 3.8, Python 3.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: lazka, paul.moore, steve.dower, tim.golden, wolma, zach.ware
Priority: normal Keywords: easy, newcomer friendly

Created on 2016-12-02 14:39 by lazka, last changed 2019-12-02 17:52 by steve.dower.

Messages (2)
msg282241 - (view) Author: Christoph Reiter (lazka) * Date: 2016-12-02 14:39
It returns True for drives which don't exist and raises for paths starting with drives which don't exist.

>>> os.path.exists("C:\\")
>>> os.path.ismount("C:\\")
>>> os.path.ismount("C:\\doesnotexist")
>>> os.path.exists("F:\\")
>>> os.path.ismount("F:\\")
>>> os.path.ismount("F:\\doesnotexist")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\lazka\AppData\Local\Programs\Python\Python35\lib\", line 290, in ismount
    return path.rstrip(seps) == _getvolumepathname(path).rstrip(seps)
FileNotFoundError: [WinError 2] The system cannot find the file specified: 'F:\\doesnotexist'
msg357723 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2019-12-02 17:52
Traditionally we handle exceptions in* functions and return False.
Date User Action Args
2019-12-02 17:52:35steve.dowersetversions: + Python 3.8, Python 3.9
messages: + msg357723

keywords: + easy, newcomer friendly
type: behavior
stage: test needed
2019-03-20 21:00:58lazkasetversions: + Python 3.7, - Python 3.5
2016-12-02 22:25:52martin.pantersettitle: os.path.mount sometimes raises FileNotFoundError on Windows -> os.path.ismount sometimes raises FileNotFoundError on Windows
2016-12-02 16:13:06wolmasetnosy: + wolma
2016-12-02 14:39:20lazkacreate