Re: [Python-Dev] Help with inotify

2005-10-28 Thread Martin v. Löwis
Neal Becker wrote: OK, does python have a C API that would allow me to create a python file object from my C (C++) code? Then instead of using python's fdopen I could just do it myself. I don't know - you will have to read the python source to find out (this is actually not a pythondev

[Python-Dev] Help with inotify

2005-10-27 Thread Neal Becker
I'm trying to make a module to support inotify (linux). I put together a module using boost::python. Problem is, inotify uses a file descriptor. If I call python os.fdopen on it, I get an error: Python 2.4.1 (#1, May 16 2005, 15:15:14) [GCC 4.0.0 20050512 (Red Hat 4.0.0-5)] on linux2 Type help,

Re: [Python-Dev] Help with inotify

2005-10-27 Thread Martin v. Löwis
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

Re: [Python-Dev] Help with inotify

2005-10-27 Thread Neal Becker
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

Re: [Python-Dev] Help with inotify

2005-10-27 Thread Martin v. Löwis
Neal Becker wrote: Yes, tried that- learned nothing. Please go back further in the trace file. There must be a return value of -1 (EISDIR) somewhere in the file, try to locate that. Here's strace. The write of '4' is where my code writes the value of fileno() to stdout, which is '4', which

Re: [Python-Dev] Help with inotify

2005-10-27 Thread Neal Becker
Martin v. Löwis wrote: Neal Becker wrote: Yes, tried that- learned nothing. Please go back further in the trace file. There must be a return value of -1 (EISDIR) somewhere in the file, try to locate that. Here's strace. The write of '4' is where my code writes the value of fileno() to

Re: [Python-Dev] Help with inotify

2005-10-27 Thread Martin v. Löwis
Neal Becker wrote: SYS_253(0, 0x7f88f0f0, 0x2dda3f00, 0x2ab4611b, 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

Re: [Python-Dev] Help with inotify

2005-10-27 Thread Bob Ippolito
On Oct 27, 2005, at 4:32 PM, Neal Becker wrote: Martin v. Löwis wrote: 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

Re: [Python-Dev] Help with inotify

2005-10-27 Thread Neal Becker
Bob Ippolito wrote: On Oct 27, 2005, at 4:32 PM, Neal Becker wrote: Martin v. Löwis wrote: 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,

Re: [Python-Dev] Help with inotify

2005-10-27 Thread Bob Ippolito
On Oct 27, 2005, at 4:58 PM, Neal Becker wrote: Bob Ippolito wrote: On Oct 27, 2005, at 4:32 PM, Neal Becker wrote: Martin v. Löwis wrote: I see. Python is making up the EISDIR, looking at the stat result. In Objects/fileobject.c:dircheck generates the EISDIR error, which apparently

Re: [Python-Dev] Help with inotify

2005-10-27 Thread Neal Becker
Martin v. Löwis wrote: 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

Re: [Python-Dev] Help with inotify

2005-10-27 Thread Neal Becker
Bob Ippolito wrote: On Oct 27, 2005, at 4:58 PM, Neal Becker wrote: Bob Ippolito wrote: On Oct 27, 2005, at 4:32 PM, Neal Becker wrote: Martin v. Löwis wrote: I see. Python is making up the EISDIR, looking at the stat result. In Objects/fileobject.c:dircheck generates the EISDIR