def readable ( path ) : try : st = os . stat ( path ) return 0 != st . st_mode & READABLE_MASK except os . error : return None return True
python check if file exists without permission
Test whether a path exists and is readable . Returns None for broken symbolic links or a failing stat () and False if the file exists but does not have read permission . True is returned if the file is readable .
def readable(path):
    """Test whether a path exists and is readable.  Returns None for
    broken symbolic links or a failing stat() and False if
    the file exists but does not have read permission. True is returned
    if the file is readable."""
    try:
        st = os.stat(path)
        return 0 != st.st_mode & READABLE_MASK
    except os.error:
        return None
    return True