In Python on Windows, is there a way to determine if a user has permission to access a directory? I've taken a look at os.access
but it gives false results.
>>> os.access('C:\haveaccess', os.R_OK)
False
>>> os.access(r'C:\haveaccess', os.R_OK)
True
>>> os.access('C:\donthaveaccess', os.R_OK)
False
>>> os.access(r'C:\donthaveaccess', os.R_OK)
True
Am I doing something wrong? Is there a better way to check if a user has permission to access a directory?