Skip to main content

is_dir_writable

Checks if a directory is writable by attempting to create a temporary file within it. Returns True if the operation succeeds, or False if an OSError occurs.

def is_dir_writable(
path: string
) - > boolean

Checks if a directory is writable by attempting to create a temporary file within it. Use this to verify filesystem permissions before initiating file operations that require write access.

Parameters

NameTypeDescription
pathstringThe filesystem path to the directory whose write permissions are being verified.

Returns

TypeDescription
booleanTrue if the directory is writable, False if an OSError occurs during the write attempt.