[Python-Dev] Function in os module for available disk space, why not?

Moshe Zadka moshez@zadka.site.co.il
Mon, 19 Mar 2001 18:00:01 +0200


On Mon, 19 Mar 2001 12:57:49 +0100, Dinu Gherman <gherman@darwin.in-berlin.de> wrote:
> I wrote on comp.lang.python today:
> > 
> > is there a simple way (or any way at all) to find out for 
> > any given hard disk how much free space is left on that
> > device? I looked into the os module, but either not hard
> > enough or there is no such function. Of course, the ideal
> > solution would be platform-independant, too... :)
> 
> Is there any good reason for not having a cross-platform
> solution to this? I'm certainly not the first to ask for
> such a function and it certainly exists for all platforms,
> doesn't it?

No, it doesn't.
Specifically, the information is always unreliable, especially
when you start considering NFS mounted directories and things
like that.

> I know that OS differ in the services they provide, but in
> this case it seems to me that each one *must* have such a 
> function

This doesn't have a *meaning* in UNIX. (In the sense that I can
think of so many special cases, that having a half-working implementation
is worse then nothing)
-- 
"I'll be ex-DPL soon anyway so I'm        |LUKE: Is Perl better than Python?
looking for someplace else to grab power."|YODA: No...no... no. Quicker,
   -- Wichert Akkerman (on debian-private)|      easier, more seductive.
For public key, finger moshez@debian.org  |http://www.{python,debian,gnu}.org