def get_disk_usage(path): """Return disk usage associated with path.""" try: total, free = _psutil_mswindows.get_disk_usage(path) except WindowsError, err: if not os.path.exists(path): raise OSError(errno.ENOENT, "No such file or directory: '%s'" % path) raise
def get_disk_usage(path): """Return disk usage associated with path.""" try: total, free = _psutil_mswindows.get_disk_usage(path) except WindowsError: if not os.path.exists(path): raise OSError(errno.ENOENT, "No such file or directory: '%s'" % path) raise used = total - free percent = usage_percent(used, total, _round=1) return nt_diskinfo(total, used, free, percent)
def get_disk_usage(path): """Return disk usage associated with path.""" try: total, free = _psutil_mswindows.get_disk_usage(path) except WindowsError: err = sys.exc_info()[1] if not os.path.exists(path): raise OSError(errno.ENOENT, "No such file or directory: '%s'" % path) raise used = total - free percent = usage_percent(used, total, _round=1) return nt_diskinfo(total, used, free, percent)