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

Bob Ippolito bob at redivi.com
Fri Oct 28 02:07:35 CEST 2005


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 comes from posixfdopen, PyFileFromFile, fillfilefields. Python simply does not support file objects which stat(2) as directories.

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. Why do you need a file object for something that is not a file anyway? select.select doesn't require file objects for example, just objects that have a fileno() method. Yes, that's a good point - the reason is I didn't want to restrict the interface to only work with select. Maybe I should rethink the interface.

Well what would the interface do if you had a file object? Are you
supposed to be able to read/write/seek/tell/etc.? I don't understand
why you're trying to do what you're doing. select.select was just an
example, select.poll's register/unregister takes any object with a
fileno also.

Note that socket isn't a file and it has a fileno also. Since what
you have isn't a file, chances are returning a file object is a bug
not a feature.

-bob



More information about the Python-Dev mailing list