Python: have urllib skip failed connection -


using nokia n900 , have urllib.urlopen statement want skipped if server offline. (if fails connect > proceed next line of code ) .

how should / done in python?

according urllib documentation, raise ioerror if connection can't made.

try:     urllib.urlopen(url) except ioerror:     # exception handling goes here if want     pass else:     dosomethinguseful() 

edit: unutbu pointed out, urllib2 more flexible. python documentation has tutorial on how use it.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -