Re: Hooking file open

2006-11-01 Thread Carl Banks
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 dat

Re: Hooking file open

2006-11-01 Thread Farshid Lashkari
Dale Strickland-Clark wrote: > You might consider trapping calls to file() too, which is an alias for > open(). Thanks, I didn't know about that. > Also, I think I'd do my logging before calling the real function. It depends > how you want to deal with exceptions. I placed the logging after the

Re: Hooking file open

2006-11-01 Thread Dale Strickland-Clark
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. Farshid Lashkari wrote: > Hi, > > My goal is to detect all (or most) file dependencies of a script (

Hooking file open

2006-11-01 Thread Farshid Lashkari
Hi, My goal is to detect all (or most) file dependencies of a script (i.e. modules, dlls, data files). Currently, after a script is finished executing I use sys.modules to determine all module dependencies, and I use win32process.EnumProcessModules to determine DLL dependencies. This works rea