Try the following (Python 2.5.x):
import logging
t=open(filename,'rb')
try:
data=t.read()
#processing data...
except:
logging.exception("Failed to process %r", filename)
finally:
t.close()
For earlier versions of Python, you will need to nest the try blocks:
import logging
t=op
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
On Jun 7, 3:33 pm, alexteo21 <[EMAIL PROTECTED]> wrote:
> I have created a script using python that will batch process data
> files every hour
> The script is running on Solaris. Python version 2.3.3
>
> t=open(filename,'rb')
> data=t.read()
> #processing data...
> t.close()
Try the following app
In article <[EMAIL PROTECTED]>,
alexteo21 <[EMAIL PROTECTED]> wrote:
> The script is working fine on the day of execution.
> It is able to process the data files very hour. However, the
> processing fail one day later i.e. the date increment by 1.
>
> Traceback (most recent call last):
> File