You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ./examples/disk_usage.py will pop-up a Windows GUI error for a non-ready
partition. I think it's better to check if 'part.fstype' is filled with a
string before progressing and calling 'psutil.disk_usage(part.mountpoint)'.
Like this:
def main():
templ = "%-17s %8s %8s %8s %5s%% %9s %s"
print_(templ % ("Device", "Total", "Used", "Free", "Use ", "Type", "Mount"))
for part in psutil.disk_partitions(all=False):
if os.name == 'nt' and part.fstype == '':
# A non-ready-disk has no fstype. E.g. if no CDROM in the drive
print ('%s\t\t Not ready' % part.device)
continue
usage = psutil.disk_usage(part.mountpoint)
print_(templ % (part.device,
bytes2human(usage.total),
bytes2human(usage.used),
bytes2human(usage.free),
int(usage.percent),
part.fstype,
part.mountpoint))
From gisle.vanem@gmail.com on July 23, 2013 12:43:18
Original issue: http://code.google.com/p/psutil/issues/detail?id=411
The text was updated successfully, but these errors were encountered: