Message314126
> 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) |
|
Date |
User |
Action |
Args |
2018-03-20 01:12:55 | eryksun | set | recipients:
+ eryksun, paul.moore, tim.golden, zach.ware, steve.dower, ldconejo |
2018-03-20 01:12:55 | eryksun | set | messageid: <1521508375.14.0.467229070634.issue33105@psf.upfronthosting.co.za> |
2018-03-20 01:12:55 | eryksun | link | issue33105 messages |
2018-03-20 01:12:53 | eryksun | create | |
|