From 3e0fed4a56311fd6921756146967a60c22cf850f Mon Sep 17 00:00:00 2001 From: Oliver Palmer Date: Tue, 25 Aug 2015 21:52:44 -0400 Subject: [PATCH] catch and ignore OSError --- pyfarm/agent/sysinfo/disks.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pyfarm/agent/sysinfo/disks.py b/pyfarm/agent/sysinfo/disks.py index 5af246cc..7c46801d 100644 --- a/pyfarm/agent/sysinfo/disks.py +++ b/pyfarm/agent/sysinfo/disks.py @@ -38,7 +38,15 @@ def disks(): """ out = [] for partition in psutil.disk_partitions(): - usage = psutil.disk_usage(partition.mountpoint) + try: + usage = psutil.disk_usage(partition.mountpoint) + + # Not all disks can return disk information. A partition + # that is mounted but does not have a file system, cdrom + # drives on Windows for example, wouldn't have any usage + # data to return. + except OSError: + continue info = DiskInfo( mountpoint=partition.mountpoint,