Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Replacement for python statvfs?

Tags:

python

The python statvfs module was marked as deprecated since python 2.6 and it's now removed since python 3.0. I haven't been able to figure out what apps are supposed to use if they want to get information about a disk, specifically how to check the capacity and free space of a given path. Anybody have any idea? This is on os x, if that makes a difference, although being cross platform would be a plus.

like image 836
Paul Wicks Avatar asked Nov 17 '09 16:11

Paul Wicks


1 Answers

It appears that only the module that contains the constants for sequential access is being deprecated.

Doing

x = os.statvfs('/')
x.f_favail 

will still work.

Sidenote: according to the docs, this function is only available on unix based platforms. So OSX and linux variants are fine, as is freeBSD and others, but windows won't be.

like image 64
Bryan McLemore Avatar answered Nov 15 '22 12:11

Bryan McLemore