Try the following:

import logging

t=open(filename,'rb')
try:
    data=t.read()
    #processing data...
except:
    logging.exception("Failed to process %r", filename)
finally:
    t.close()




-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to