Re: [Tutor] Filesystem Usage

2007-01-19 Thread Steve Nelson
On 1/19/07, Kent Johnson <[EMAIL PROTECTED]> wrote: > The attribute access uses . notation and an attribute name. You can do > stat.f_blocks and gstat.gr_gid. Python takes care of looking up the > actual attribute value. Excellent - thank you. > I suggest you use the attribute form for both, it

Re: [Tutor] Filesystem Usage

2007-01-19 Thread Kent Johnson
Steve Nelson wrote: > On 9/22/06, Steve Nelson <[EMAIL PROTECTED]> wrote: > >> In the end I just did: >> >> def fsUsage(dir): >> """Returns the % usage of a given filesystem""" >> stat = os.statvfs(dir) >> from statvfs import F_BLOCKS, F_BFREE >> total = stat[F_BLOCKS] >> avail = stat[F_

Re: [Tutor] Filesystem Usage

2007-01-19 Thread Steve Nelson
On 9/22/06, Steve Nelson <[EMAIL PROTECTED]> wrote: > In the end I just did: > > def fsUsage(dir): > """Returns the % usage of a given filesystem""" > stat = os.statvfs(dir) > from statvfs import F_BLOCKS, F_BFREE > total = stat[F_BLOCKS] > avail = stat[F_BFREE] > used = total-avail >

Re: [Tutor] Filesystem Usage

2006-09-22 Thread Steve Nelson
On 9/22/06, wesley chun <[EMAIL PROTECTED]> wrote: > this sounds like it will require some work to implement 'df' in > Python Mmm... although I have discovered a debian package called pydf whose source made interesting reading. > i'd use the one of > the {os,popen2}.popen*() functions or the sub

Re: [Tutor] Filesystem Usage

2006-09-21 Thread wesley chun
> How can I go about getting info similar to that which the UNIX df > command provides - of filesystem usage and inode usage? I could just > shell out and run a df command, but I would rather use python > bindings. this sounds like it will require some work to implement 'df' in Python, *and* it w