stat st_rdev in python

Louis Glassy glassy at
Sat Jul 28 00:08:36 CEST 2001

Is there a way to find out unix device major/minor numbers
_in_ Python 2.1, without using an external C module or program?

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.


Thanks in advance, and thanks particularly to all the Python
developers for making the language a pleasure to work with!


More information about the Python-list mailing list