Re: Modifying a built-in function for logging purposes

2005-05-15 Thread Bengt Richter
On Sat, 14 May 2005 19:19:08 -0700, Robert Kern [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Hi Greg, thank for your replay, but I didn't succeed in any way. You must consider however that I'm not a Python expert... IMHO, it must be a script that change part of the interpreter, and

Re: Modifying a built-in function for logging purposes

2005-05-15 Thread Bengt Richter
On Sun, 15 May 2005 07:52:42 +0200, Fredrik Lundh [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: I wonder if it is possible to change (temporarily) a built-in function for logging purposes. Let me explain: I want to log all the 'open' operations, recording the file to be opened, the mode

Re: Modifying a built-in function for logging purposes

2005-05-15 Thread qwweeeit
Hi Robert, Short answer: if you don't know stuff like this, then you probably shouldn't mess around with the builtins in production code. I begin to be fed up of beeing treated as a child who is only able to make damages... But this time you are right... So let's change point of view: instead of

Re: Modifying a built-in function for logging purposes

2005-05-15 Thread Steven D'Aprano
On Sat, 14 May 2005 15:14:01 -0700, qwweeeit wrote: Hi Greg, thank for your replay, but I didn't succeed in any way. You must consider however that I'm not a Python expert... Can you post what you did and what results you got? Because Greg's trick worked for me. See below. IMHO, it must be

Re: Modifying a built-in function for logging purposes

2005-05-14 Thread Greg Krohn
[EMAIL PROTECTED] wrote: Hi all, I wonder if it is possible to change (temporarily) a built-in function for logging purposes. Let me explain: I want to log all the 'open' operations, recording the file to be opened, the mode (r/w/a...) and (possibly) the module which made the call. After

Re: Modifying a built-in function for logging purposes

2005-05-14 Thread qwweeeit
Hi Greg, thank for your replay, but I didn't succeed in any way. You must consider however that I'm not a Python expert... IMHO, it must be a script that change part of the interpreter, and substitute a new module (py) in the place of the standard one (py or pyc). The standard module must be saved

Re: Modifying a built-in function for logging purposes

2005-05-14 Thread Robert Kern
[EMAIL PROTECTED] wrote: Hi Greg, thank for your replay, but I didn't succeed in any way. You must consider however that I'm not a Python expert... IMHO, it must be a script that change part of the interpreter, and substitute a new module (py) in the place of the standard one (py or pyc).

Re: Modifying a built-in function for logging purposes

2005-05-14 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: I wonder if it is possible to change (temporarily) a built-in function for logging purposes. Let me explain: I want to log all the 'open' operations, recording the file to be opened, the mode (r/w/a...) and (possibly) the module which made the call. import sys