Skip to content

Latest commit

 

History

History
36 lines (22 loc) · 487 Bytes

File metadata and controls

36 lines (22 loc) · 487 Bytes

PermissionError: [Errno 13] Permission denied: '.'

Occurs when trying to perform a restricted operation on a directory.

Reproduce

import os

folder_path = "."

os.remove(folder_path)

Error Message

PermissionError: [Errno 13] Permission denied: '.'

Fix

import os

file_path = "data.txt"

with open(file_path, "w") as file:
    file.write("hello")

os.remove(file_path)

Reflection

Tried removing a directory as if it were a file.