Hooking file open

Carl Banks pavlovevidence at gmail.com
Thu Nov 2 00:42:56 EST 2006


Dale Strickland-Clark wrote:
> You might consider trapping calls to file() too, which is an alias for
> open().
>
> Also, I think I'd do my logging before calling the real function. It depends
> how you want to deal with exceptions.

OP should hook into os.open as well.  Plus, I don't think the database
modules (dbm, gdbm, bsddb) use Python open, so might want to hook into
those as well.  You have be careful with extension modules; they often
open files their own way.


Carl Banks




More information about the Python-list mailing list