leegold2
Technical User
- Oct 10, 2004
- 116
Hi,
Is there a way to do the following? Using Python 2.1,
Say I have a WHILE loop. Inside the WHILE there's code that reads and processes lines of data. About one out of ten times (ie. sometimes) there's a data record that causes a crash and the program terminates. I can put a try/except and the error message is catched when program terminates.
But is there a way to keep looping through the data?
One choice is to filter the bad crashing lines w/IF-THEN and only process stuff in the WHILE that won't crash it.
BUT, is there another way? Like a "retry" or "recover" that says something like: "Yeah you crashed the script with this nasty line of data, but I'm going back into the loop and will continue process the next line and do this until EOF."
It'd have to trap the exception, keep state to a degree, and start the loop...
Is this possible?
Thanks,
Lee
Is there a way to do the following? Using Python 2.1,
Say I have a WHILE loop. Inside the WHILE there's code that reads and processes lines of data. About one out of ten times (ie. sometimes) there's a data record that causes a crash and the program terminates. I can put a try/except and the error message is catched when program terminates.
But is there a way to keep looping through the data?
One choice is to filter the bad crashing lines w/IF-THEN and only process stuff in the WHILE that won't crash it.
BUT, is there another way? Like a "retry" or "recover" that says something like: "Yeah you crashed the script with this nasty line of data, but I'm going back into the loop and will continue process the next line and do this until EOF."
It'd have to trap the exception, keep state to a degree, and start the loop...
Is this possible?
Thanks,
Lee