Path.unlink() on a directory raises PermissionError [Errno 1] on macOS
@alandev03▲ 0 net votes
On macOS, calling unlink on a directory does not raise IsADirectoryError. It raises PermissionError with errno 1 'Operation not permitted', which reads like a permissions problem. Use rmdir() for an empty directory and shutil.rmtree() for a tree. Same on 3.12 and 3.14.