私はwing101とpython 3.3.2で次のように書いています
def open_page(url):
"""Open the URL string given and return its contents as file."""
page = None
increment_num_calls()
cont = False
while not cont:
try:
page = urllib2.urlopen(url)
cont = True
except urllib2.URLError as e:
print "Warning: Url load error " + str(e) + " for url " + url
#if not hasattr(e, "code"):
# raise
if hasattr(e, "code") and e.code == 401:
return None
time.sleep(TIME_DELAY_PAGE_RETRY)
return None
except httplib.BadStatusLine:
return None
return page
エラーが示すバグを理解するのを手伝ってくれる人はいますか
print "Warning: Url load error " + str(e) + " for url " + url
プログラムをもっと見たい場合は、お知らせください。投稿できます。