stat st_rdev in python

Thomas Wouters thomas at
Tue Jul 31 09:09:32 EDT 2001

On Fri, Jul 27, 2001 at 10:08:36PM +0000, Louis Glassy wrote:

> The tuple returned by os.stat() does not return the stat 
> st_rdev field, which contains the information I need.

> I see two options:  either write my own binding to stat(2)
> or do something like a popen on /bin/ls.  These both work,
> though neither is attractive.  It'd be nice if there were
> an unaldulterated posix module that I could call and get
> what everything that stat(2) would return.

You could write an unadulterated posix module that returned more
information. In that case, os.stat() should return an object that acts like
a 10-length tuple, except that the new fields (and the old ones) could be
accessed as attributes. You can't make it return a 13-length tuple as that
would break software that depends on the length of the tuple. After it's
done, you can submit a patch to SF :-)

Thomas Wouters <thomas at>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!

More information about the Python-list mailing list