The Danny Bos wrote:
Heya,
I'm running a py script that simply grabs an image, creates a
thumbnail and uploads it to s3. I'm simply logging into ssh and
running the script through Terminal. It works fine, but gives me an
IOError every now and then.
I was wondering if I can catch this error and just get the script to
start again?
I mean, in Terminal it dies anyway, so I have to start it again by
hand, which is a pain as it dies so sporadically. Can I automate this
error, catch it and just get it to restart the loop?
Thanks for your time and energy,
Exceptions can be caught. You could do something like this:
while True:
try:
do_something()
break
except IOError:
pass
--
http://mail.python.org/mailman/listinfo/python-list