Catching ValueError: unknown url type: urllib2 Python -


i'm getting following exception when enter invalid url: valueerror: unknown url type: blob

i'm trying catch error following code it's not working:

try:     req = urllib2.request(url)     conn =  urllib2.urlopen(req)     content = conn.read() except urllib2.urlerror, e:     print 'error: invalid url' 

if notice, base error valueerror, so

import urllib2 url = 'blob' try:     req = urllib2.request(url)     conn =  urllib2.urlopen(req)     content = conn.read() except valueerror, e:     print 'error: invalid url' 

Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -