Message356771
https://docs.python.org/3.8/library/shutil.html#shutil.disk_usage
There's no mention that this helper function simply calls `os.statvfs()` in the background. Something that is quite troubling when you're trying to get disk_usage (or disk-information) about a non-mounted drive.
It's clear as day if you see the code: https://github.com/python/cpython/blob/master/Lib/shutil.py#L1249
But if you're a novice user, this will puzzle your brain.
Because the end result will be that `disk_usage()` returns the same information for all these cases:
shutil.disk_usage('/dev/sda')
shutil.disk_usage('/dev/sdb')
shutil.disk_usage('/dev/sdc')
Which translates to:
os.statvfs('/dev/sd?')'
--
All I'm asking, is that we add a little note stating:
"On *mounted* filesystems" or a reference to `os.statvfs()` where it's clearly stated that it runs on mounted filesystems.
Thanks in advance. |
|
Date |
User |
Action |
Args |
2019-11-16 22:19:58 | Lord Anton Hvornum | set | recipients:
+ Lord Anton Hvornum, docs@python |
2019-11-16 22:19:58 | Lord Anton Hvornum | set | messageid: <1573942798.11.0.196925055555.issue38825@roundup.psfhosted.org> |
2019-11-16 22:19:58 | Lord Anton Hvornum | link | issue38825 messages |
2019-11-16 22:19:57 | Lord Anton Hvornum | create | |
|