Eryk Sun <eryk...@gmail.com> added the comment: > If you use os.listdir() on the networked folder, the log file > will come up.
Querying a file's parent directory (e.g. via os.scandir in Python 3) can provide a basic stat (i.e. attributes, reparse tag, size, and timestamps) when opening the file directly fails. Currently the os.[l]stat implementation in Python 3 falls back on querying the directory for ERROR_ACCESS_DENIED (e.g. due to a file's security, delete disposition, or an exclusive open) and ERROR_SHARING_VIOLATION (e.g. a system paging file). This could be expanded to ERROR_PATH_NOT_FOUND, which among other reasons, can indicate the path was too long if long-path support isn't available. This would expand the reach to all files in which the path of the parent directory is less than MAX_PATH. This would keep os.[l]stat consistent with os.listdir and os.scandir, which it currently is not. For example: >>> parent_path, filename = os.path.split(path) >>> len(path), len(parent_path), filename (264, 255, 'spam.txt') >>> os.path.exists(path) False >>> entry = next(os.scandir(parent_path)) >>> entry.name 'spam.txt' >>> entry.stat() os.stat_result(st_mode=33206, st_ino=0, st_dev=0, st_nlink=0, st_uid=0, st_gid=0, st_size=0, st_atime=1521507879, st_mtime=1521507879, st_ctime=1521507879) ---------- components: +Windows stage: -> needs patch versions: +Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33105> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com