Downloading Image
<p>I used urllib2.build_opener() to download an image from a corresponding url.But for a particular url I am getting an error.  When I checked that url, I saw that there is no image.  How can I check whether there is an image or not?  This is my code:</p>

<pre><code>opener1 = urllib2.build_opener()
page1=opener1.open(orginal)
my_picture=page1.read()
</code></pre>

<p>The error i got is </p>

<pre><code>  File "suitcase.py", line 120, in &lt;module&gt;
    get_suitcase()
  File "suitcase.py", line 96, in get_suitcase
    page1=opener1.open(orginal)
  File "D:\Program Files\Python\lib\urllib2.py", line 395, in open
    response = meth(req, response)
  File "D:\Program Files\Python\lib\urllib2.py", line 508, in http_response
    'http', request, response, code, msg, hdrs)
  File "D:\Program Files\Python\lib\urllib2.py", line 433, in error
    return self._call_chain(*args)
  File "D:\Program Files\Python\lib\urllib2.py", line 367, in _call_chain
    result = func(*args)
  File "D:\Program Files\Python\lib\urllib2.py", line 516, in http_error_default

    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 404: Not Found
</code></pre>

<p>How do I check that an image is there and proceed with saving that image?</p>
