[Tutor] Re: Can I hook a "file" to a python script?

Lee Harr missive at hotmail.com
Fri Nov 7 18:52:22 EST 2003

>I'd like a "file" on the Linux box to actually be the input and output
>of a Python script.  Anything written to the file would be sent to a
>database and anything read from the file would come from the database.
>I know how to do the database end of this but I'm not sure if a script
>can be hooked to a "file" transparently.  The script would probably
>have to be run as a daemon.  I doubt there's enough magic in the Linux
>world to make it so that a read/write would actually launch the script.

Doubt not  :o)

You could create a kernel module which does something special
when a particular device node is accessed, for instance.

Maybe what you are looking for is a socket?

In BSD, there is also the kqueue interface (and py-kqueue of course)

There are interfaces which have been around for a while, and are very
well thought out. (files, devices, sockets, etc) and it is likely that if 
are trying to do something so far outside of the box that linux does not
have the special magic that you need... well... that does not sound

Of course, maybe you are inventing a new and better interface.

It sounds interesting, anyhow.

STOP MORE SPAM with the new MSN 8 and get 2 months FREE* 

More information about the Tutor mailing list