[Tutor] intercepting and recored I/O function calls
Jojo Mwebaze
jojo.mwebaze at gmail.com
Tue Sep 21 22:02:00 CEST 2010
I found this recipe quite related
http://code.activestate.com/recipes/198078/
it logs all methods calls with their parameters and return values.. Can this
be modified to include any other outputs of the module, which are not
specified with the return statement.
cheers
On Fri, Sep 17, 2010 at 6:47 PM, Alan Gauld <alan.gauld at btinternet.com>wrote:
> "Jojo Mwebaze" <jojo.mwebaze at gmail.com> wrote
>
> My applogies to begin with, it seems i didnt state my problem clearly for
>> this particular case - perharps I/O was not the best way to describe my
>> problem.
>>
>
> Hmmm, perhaps not! :-)
>
>
> Specifically, i would like to track all inputs/output to modules/functions
>> -
>> if a module retrieved and used files and run some analysis on them and
>> produced other files in return, i would like to take not of this. i.e what
>> i
>> want is to recored input and outputs to a module. and also to record all
>> paramaters, attribute vaules used by the same module.
>>
>
> You could do some of that with static code analysis I think.
> And while I'm sure you could do this by delving into the innards of
> Python it will be a lot of work and I'm not sure what the impact
> would be on the performance of your code.
>
>
> I thought i would build a wrapper around the orignial python program or
>> probably pick this information at OS level.
>>
>
> I don't think the OS will have much of what you want you will need to
> look inside Python itself I think. It might be best to tweak the
> interpreter
> to trap those details but that would need to be done in C. And it would
> slow the interpreter down for everything.
>
> The OS knows how your app is interacting with the network and file
> system but it doesn't know about the interactons between modules
> inside Python. Maybe there are some of the more obscure modules
> in the standard library that allow monitoring. The debug and profiling
> modules might yield clues too.
>
> An interesting challenge and I'm not sure how I'd go about it myself.
> Might be a good one to try on the main comp.lang.python list, its
> certainly not typical newbie stuff!
>
> Alan G.
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100921/68768787/attachment.html>
More information about the Tutor
mailing list