Skip to content

Commit

Permalink
catch and ignore OSError
Browse files Browse the repository at this point in the history
  • Loading branch information
opalmer committed Aug 26, 2015
1 parent d27c65f commit 3e0fed4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pyfarm/agent/sysinfo/disks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 3e0fed4

Please sign in to comment.