Modifying running code? [HACK ALERT]

Bjoern Giesler un4e at rzstud1.rz.uni-karlsruhe.de
Mon Dec 11 11:15:52 EST 2000


Hi,

Hans Nowak <ivnowa at hvision.nl> wrote:
: "Python uses the ``termination'' model of error handling: an exception
: handler can find out what happened and continue execution at an outer
: level, but it cannot repair the cause of the error and retry the failing
: operation (except by re-entering the offending piece of code from the
: top)."

...which is what I want to do, except I want to replace the offending piece
of code by something else first :-) This is very interesting to know. Thanks
a lot!

: [...] Editing the code will
: be a problem too; you will need to point the program to a string or text
: file that holds the function code, [...]

This is what the traceback module does anyway -- it finds the original file
and the line that caused the exception. I only need to additionally find the
beginning and end of the function that contains the line.

Regards,
		--Björn



More information about the Python-list mailing list