Skip to content

Commit

Permalink
fix #1
Browse files Browse the repository at this point in the history
  • Loading branch information
SlightDust committed Mar 26, 2022
1 parent 1de3ac9 commit bc7c418
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,8 @@ swap
累计I/O: 25.1M / 175.4M
硬盘:
标识: /dev/vda1 挂载点: / 总空间: 58.9G 已使用: 35.1G (62.2%) 剩余: 21.3G
```
```

# 日志
2022/03/25 摸了。
2022/03/27 fix WinServer存在一个CD驱动器导致读取硬盘信息报错 [#1](https://github.com/pcrbot/sys_stats_HoshinoBot/issues/1)
6 changes: 5 additions & 1 deletion sys_stats_HoshinoBot.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ def get_disk():
for disk in psutil.disk_partitions():
disk_list.append([disk[0], disk[1]]) # 标识,挂载点
for disk in disk_list:
usage = psutil.disk_usage(disk[1])
try:
usage = psutil.disk_usage(disk[1])
except (PermissionError, psutil.AccessDenied):
# 无法读取硬盘,WinServer有可能是一个光驱导致,跳过
continue
disk_temp = {
"标识": disk[0],
}
Expand Down

0 comments on commit bc7c418

Please sign in to comment.