Closed
Description
Documentation
In the documentation for os.remove
it states:
Remove (delete) the file path. If path is a directory, an IsADirectoryError is raised. Use rmdir() to remove directories. If the file does not exist, a FileNotFoundError is raised.
This is the case on Linux:
$ python -c 'import os, tempfile; os.remove(tempfile.mkdtemp())'
Traceback (most recent call last):
File "<string>", line 1, in <module>
IsADirectoryError: [Errno 21] Is a directory: '/tmp/tmphxrd1p6n'
However on macOS this results in a PermissionError
:
$ python3 -c 'import os, tempfile; os.remove(tempfile.mkdtemp())'
Traceback (most recent call last):
File "<string>", line 1, in <module>
PermissionError: [Errno 1] Operation not permitted: '/var/folders/1g/q2y74s696ng0v_cmb9sv7qgr0000gn/T/tmpawxhz8wm'