Recommendations (or best practices) to define functions (or methods)

Gabriel Genellina gagsl-py at
Mon Jan 8 18:22:00 CET 2007

At Monday 8/1/2007 10:25, vizcayno wrote:

>However, what happens when the error is due to data error. Or when the
>program is reading many files to save data into a database and one or
>two files have problems with data format. I would like to keep the
>program running (using exception in a controlled way) for the remaining
>good files and prepare a log about the failed files. How to keep the
>same function for a program that runs in batch, or on-line or in  the
>web? Giving the simple example I put, I would like to find more

Deal with the exception at a higher level. In your example, you have 
some files to be processed:

for fname in filenames:


for fname in filenames:
     except StandardError, E:

Gabriel Genellina
Softlab SRL 


Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas, 
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 

More information about the Python-list mailing list