loop error in python

Solutions on MaxInterview for loop error in python by the best coders in the world

showing results for - "loop error in python"
Lucille
09 Oct 2017
1try:
2    # smallest block of code you foresee an error in
3    response = language_client.analyze_sentiment(document=document) # I think your exception is being raised in this call
4except InvalidArgument as e:
5    # your trace shows InvalidArgument being raised and it appears you dont care about it
6    continue # continue to next iteration since this error is expected
7except SomeOtherOkayException as e:
8    # this is an example exception that is also OK and "skippable"
9    continue # continue to next iteration
10except Exception as e:
11    # all other exceptions are BAD and unexpected.This is a larger problem than just this loop
12    raise e # break the looping and raise to calling function
13
14sentiment = response.document_sentiment
15sentimentscore_list.append(sentiment.score)
16magnitude_list.append(sentiment.magnitude)
17# Add the description that was actually used to the description list
18description_list.append(descr)
19# more code here...