New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pathlib.Path('/').mkdir() raises wrong error type #69989
Comments
pathlib.Path('/').mkdir() raises an IsADirectoryError instead of a FileExistsError. |
It looks like this is an OSX-specific behavior, and not a python problem: |
The mkdir method needs a fix similar to what was done for bpo-25583. For example, currently on Windows the exist_ok option doesn't handle the PermissionError raised when [accidentally] trying to create the root directory: >>> pathlib.Path('C:/').mkdir(exist_ok=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\Python 3.5\lib\pathlib.py", line 1199, in mkdir
self._accessor.mkdir(self, mode)
File "C:\Program Files\Python 3.5\lib\pathlib.py", line 371, in wrapped
return strfunc(str(pathobj), *args)
PermissionError: [WinError 5] Access is denied: 'C:\\' |
I can't test on Windows and OSX but I suppose PR 805 fixes both issues. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: