Check if command had some trouble in Python?

Posted by Shady on Stack Overflow See other posts from Stack Overflow or by Shady
Published on 2010-04-30T16:10:54Z Indexed on 2010/04/30 16:17 UTC
Read the original article Hit count: 260

Filed under:
|

I have this command

h = urllib.urlopen("http://google.com/")

How can I check if it retrieves me some error, internet down or something I don't expect?

For example, something like

if error print 'ERROR'

Thank you

© Stack Overflow or respective owner

Related posts about python

Related posts about error