Interpreting os.lstat()

Adrian Petrescu apetresc at
Thu Jul 19 02:55:59 CEST 2007

I'm playing with FUSE's python bindings, and I'm expected to return a
list that matches the structure of a python os.lstat() call. So, for

>>> import os
>>> os.lstat("/home/adrian/fuse_test")
(16877, 10666636L, 2050L, 4, 1000, 1000, 4096L, 1184803155,
1184170289, 1184170289)

The problem is, I'm not sure how to recreate this kind of structure
because I have no idea about the significance of the entries. The
docstring wasn't much help:

>>> print os.lstat.__doc__
lstat(path) -> stat result

Like stat(path), but do not follow symbolic links.
>>> print os.stat.__doc__
stat(path) -> stat result

Perform a stat system call on the given path.

I checked the online Python documentation at
but it just says to "consult the documentation for your system.". At
this point I'm guessing that os.lstat is nothing more than a wrapper
for some Linux system call, so I looked up the results of running
'stat' on the same file, and I get:

adrian at adrian-desktop:~$ stat fuse_test/
  File: `fuse_test/'
  Size: 4096            Blocks: 8          IO Block: 4096   directory
Device: 802h/2050d      Inode: 10666636    Links: 4
Access: (0755/drwxr-xr-x)  Uid: ( 1000/  adrian)   Gid: ( 1000/
Access: 2007-07-18 19:59:15.000000000 -0400
Modify: 2007-07-11 12:11:29.000000000 -0400
Change: 2007-07-11 12:11:29.000000000 -0400

I can see some correspondence between the "stat" call and os.lstat
(for example, I'm guessing os.lstat(path)[6] represents the filesize),
but I can't see the correspondence between some of the other fields.
What does os.lstat(path)[0] represent? Are those last three the
created/modified/accessed times in unix time or what? Basically, what
does each field of os.lstat(path) represent?

My system is Linux 2.6.20 and I'm using Python 2.5.1
Thanks in advance, guys! =)

More information about the Python-list mailing list