[Python-Dev] Help with inotify (original) (raw)

Neal Becker ndbecker2 at gmail.com
Thu Oct 27 20:17:03 CEST 2005


"Martin v. Löwis" wrote:

Neal Becker wrote:

Any ideas? I'd rather not have to trace through python if I could avoid it (I don't even have source installed here). Use strace, then. Find out what precise system call gives you this error. If this is not enough clue, post the relevant fragment of the trace output. Usage would be strace -o muell python testnotify.py (look into the file muell afterwards)

Yes, tried that- learned nothing.

I suspect what's happening is that python's fdopen is using some stat call to determine whether the file descriptor refers to a directory, and is getting an answer that the inotify fd does. Don't know what to do about it. Can I build a python file object in "C" from the fd?

Here's strace. The write of '4' is where my code writes the value of fileno() to stdout, which is '4', which is correct - notice that open("test-inotify.py") returned '3': ... open("test-inotify.py", O_RDONLY) = 3 write(2, " File "test-inotify.py", line 6"..., 39) = 39 fstat(3, {st_mode=S_IFREG|0664, st_size=87, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2aaaadc13000 read(3, "from inotify import *\nimport os\n"..., 4096) = 87 write(2, " ", 4) = 4 write(2, "os.fdopen (i.fileno())\n", 23) = 23 close(3) = 0 munmap(0x2aaaadc13000, 4096) = 0 write(2, "IOError", 7) = 7 write(2, ": ", 2) = 2 write(2, "[Errno 21] Is a directory", 25) = 25



More information about the Python-Dev mailing list