IOError and Try Again to loop the loop.

Alex Hall mehgcap at gmail.com
Sun Jul 11 22:35:07 EDT 2010


It seems like seeing the code, or at least the bit in question, would
be easier, but what about:

for img in range(0, len(imagesToUpload:))
 try:
  #do the thumbnail / upload thing on images[i]
 exceptIOError:
  i=0

This will duplicate a lot of the images already processed, but you
said you are just restarting the script anyway. If you are in a while
loop, just move the processing to the for loop and use the while to
add all images to be processed to a list.

On 7/11/10, The Danny Bos <dannybos at gmail.com> 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,
>
> Danny
> --
> http://mail.python.org/mailman/listinfo/python-list
>


-- 
Have a great day,
Alex (msg sent from GMail website)
mehgcap at gmail.com; http://www.facebook.com/mehgcap



More information about the Python-list mailing list