goalie.has_access

goalie.has_access(x: str | PathLike[str], access: str = 'r') bool

Check filesystem access rights.

Parameters:
  • x (str or os.PathLike) – Path to check.

  • access (str) – Access rights to check, as a string of r/w/x.

Returns:

True if x has the requested access rights.

Return type:

bool

Examples

>>> import os
>>> has_access(os.path.expanduser("~"))
True
>>> has_access("nonexistent_path_xyz")
False