0
我知道這個問題已被問到,但我還沒有得到解決方案。 我認爲這個異常應該繼續for循環,但它不會。 已經花了一些時間來解決這個問題,但我找不到任何好的解決方案。 有什麼想法嗎?Python異常後繼續
for store in CREATE:
#print "Create ticket:"
print '-' * 80
print store.storeNumber, store.date
br.open(OPEN_NEW_CASE_URL)
form = br.select_form("selsite01")
try:
#assert store.internalID
br["site_id"] = [store.internalID]
except AttributeError:
CREATE.remove(store) # if store is not found on the m***** drop down field
print "[WARNING] Store", store.storeNumber ,"not found in the ticket list, could not create."
continue
br.submit()
""" Build ticket from config file """
br.select_form("newcase")
[.... more code ....]
br.open(LOGOUT_URL) # be nice and logout
編輯(解決問題):
try:
#assert store.internalID
br["site_id"] = [store.internalID]
except AttributeError:
print "[WARNING] Store", store.storeNumber ,"not found in the ticket list, could not create."
continue
br.submit()
請嘗試運行時顯示程序的輸出。 – msvalkon
在循環中從CREATE中刪除存儲不是一個好主意。 –
從CREATE中刪除商店是一個愚蠢的不必要的想法。 – enthus1ast