Can I hook a "file" to a python script?

Alan Gauld alan.gauld at btinternet.com
Sat Nov 8 03:58:36 EST 2003


On Fri, 7 Nov 2003 20:39:49 -0800, Scott Chapman
<scott_list at mischko.com> wrote:
> 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. 

This can be done - indeed its how the ClearCase config management
tool works on *nix - but it involves some low level magic. I
believe you need to swap out the read/write system calls. I don't
pretend to know how you do that but it can be done. Whether you
could do it in pure Python I doubt, but a C program that called
Python maybe.

Alan G.
Author of the Learn to Program website
http://www.freenetpages.co.uk/hp/alan.gauld




More information about the Python-list mailing list