Message309992
Issue 26330 was resolved by documenting that shutil.disk_usage requires a directory. However, the shutil module is in a position to harmonize cross-platform behavior in ways that aren't normally possible or recommended in the low-level os module. To that end, the Windows implementation could retry calling nt._getdiskusage on the resolved parent directory in case of NotADirectoryError. For example:
def disk_usage(path):
try:
total, free = nt._getdiskusage(path)
except NotADirectoryError:
path = os.path.dirname(nt._getfinalpathname(path))
total, free = nt._getdiskusage(path)
used = total - free
return _ntuple_diskusage(total, used, free)
Alternatively, this could be addressed in the implementation of nt._getdiskusage itself. |
|
Date |
User |
Action |
Args |
2018-01-15 15:26:52 | eryksun | set | recipients:
+ eryksun, paul.moore, tim.golden, zach.ware, steve.dower |
2018-01-15 15:26:52 | eryksun | set | messageid: <1516030012.51.0.467229070634.issue32557@psf.upfronthosting.co.za> |
2018-01-15 15:26:52 | eryksun | link | issue32557 messages |
2018-01-15 15:26:52 | eryksun | create | |
|