Skip to content
This repository has been archived by the owner on Apr 29, 2023. It is now read-only.

Commit

Permalink
psutil模組出現問題時,會傳送錯誤詳細訊息
Browse files Browse the repository at this point in the history
  • Loading branch information
Alllen95Wei committed Dec 24, 2021
1 parent ab7057d commit 6aac4e9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions detect_pc_status.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
def pc_status():
import psutil

i = 1
while i > 0:
try:
import psutil
msg = "CPU使用率:" + str(psutil.cpu_percent()) + "%" + " / 記憶體使用率:" + str(psutil.virtual_memory().percent) + "%"
return msg
except Exception as e:
msg = "```" + str(e) + "```"
return msg


if __name__ == "__main__":
Expand Down

0 comments on commit 6aac4e9

Please sign in to comment.