[Python-Dev] Help with inotify

"Martin v. Löwis" martin at v.loewis.de
Thu Oct 27 23:02:40 CEST 2005


Neal Becker wrote:
> SYS_253(0, 0x7fffff88f0f0, 0x2aaaadda3f00, 0x2aaaaab4611b, 0x7) = 4
> close(3)                                = 0
> futex(0x502530, FUTEX_WAKE, 1)          = 0
> futex(0x502530, FUTEX_WAKE, 1)          = 0
> fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 3), ...}) = 0
> mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
> 0x2aaaadc12000
> write(1, "4\n", 2)                      = 2
> fcntl(4, F_GETFL)                       = 0 (flags O_RDONLY)
> fstat(4, {st_mode=S_IFDIR|0600, st_size=0, ...}) = 0
> mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
> 0x2aaaadc13000
> lseek(4, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
> fstat(4, {st_mode=S_IFDIR|0600, st_size=0, ...}) = 0
> close(4)                                = 0
> munmap(0x2aaaadc13000, 4096)            = 0
> write(2, "Traceback (most recent call last"..., 35) = 35

I see. Python is making up the EISDIR, looking at the stat result.
In Objects/fileobject.c:dircheck generates the EISDIR error, which
apparently comes from posix_fdopen, PyFile_FromFile,
fill_file_fields.

Python simply does not support file objects which stat(2) as directories.

Regards,
Martin


More information about the Python-Dev mailing list