Author eryksun
Recipients eryksun, paul.moore, steve.dower, tim.golden, zach.ware
Date 2018-01-15.15:26:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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):
            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:52eryksunsetrecipients: + eryksun, paul.moore, tim.golden, zach.ware, steve.dower
2018-01-15 15:26:52eryksunsetmessageid: <>
2018-01-15 15:26:52eryksunlinkissue32557 messages
2018-01-15 15:26:52eryksuncreate