Re: Resuming a program's execution after correcting error



Sheldon wrote:
Does anyone know if one can resume a python script at the error point
after the error is corrected?
I have a large program that take forever if I have to restart from
scratch everytime. The error was the data writing a file so it seemed
such a waste if all the data was lost and must be recalculated again.

May be you could put some parameter to your main loop:

start_point=begin
if start_point==begin: output=open('outputfile', 'w')
else : output=open('outputfile', 'a')

while start_point <= case <= end_point:

try:
do_complex_computation(case)
except Exception:
print case
break

If you get an error you repair the program and set

start_point=case

and go on with the program.

Tuomas
.