psutil.disk_partitions shows Used as Zero?

24 views
Skip to first unread message

John Radley

unread,
Apr 17, 2021, 8:19:52 AM4/17/21
to psutil
I have this code fragment:-

def diskusage(path: str) -> str:
    total, used, free = shutil.disk_usage(path)

but used is Zero and Total = Free
On Ubuntu Groovy, with Python 3.9.4, and psutils 5.8.0
I'm probably doing something wrong.
Can you help?

Like this:-
MOUNTPOINT: /                  TOTAL: 8262942720       USED: 0            FREE: 8262942720          
MOUNTPOINT: /boot          TOTAL: 8262942720       USED: 0            FREE: 8262942720          
MOUNTPOINT: /boot/efi     TOTAL: 8262942720      USED: 0            FREE: 8262942720          
MOUNTPOINT: /mnt/sda2  TOTAL: 8262942720      USED: 0            FREE: 8262942720   

John Radley

unread,
Apr 18, 2021, 6:30:36 AM4/18/21
to psutil

Silly me!
A little Cut & Paste dyslexia, not shown above.
All sorted now.
Sorry!
Reply all
Reply to author
Forward
0 new messages