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?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…