title: getting permission denied error on downloading and saving images from url
body: <p>I'm trying to make web scraper that downloads images from searched keywords. The code works completely fine until it has to download that image from extracted URL</p>
  <pre><code>from bs4 import BeautifulSoup
  import requests
  import os
  import urllib
  
  search = raw_input(&quot;search for images: &quot;)
  params = {&quot;q&quot;: search}
  r = requests.get(&quot;http://wwww.bing.com/images/search&quot;, params=params)
  dir_name = search.replace(&quot; &quot;, &quot;_&quot;).lower()
  
  if not os.path.isdir(dir_name):
      os.makedirs(dir_name)
  
  soup = BeautifulSoup(r.text, &quot;html.parser&quot;)
  links = soup.findAll(&quot;a&quot;, {&quot;class&quot;: &quot;thumb&quot;})
  
  for items in links:
      img_obj = requests.get(items.attrs[&quot;href&quot;])
      print &quot;Getting: &quot;, items.attrs[&quot;href&quot;]
      title = items.attrs[&quot;href&quot;].split(&quot;/&quot;)[-1]
      urllib.urlretrieve(items.attrs[&quot;href&quot;], &quot;./scraped_images/&quot;)
  </code></pre>
  <p>OUTPUT:</p>
  <pre><code>search for images: cats
  Getting:  http://c1.staticflickr.com/3/2755/4353908962_2a0003aebf.jpg
  Traceback (most recent call last):
    File &quot;C:/Users/qazii/PycharmProjects/WebScraping/exm.py&quot;, line 21, in &lt;module&gt;
      urllib.urlretrieve(items.attrs[&quot;href&quot;], &quot;./scraped_images/&quot;)
    File &quot;E:\anaconda\envs\WebScraping\lib\urllib.py&quot;, line 98, in urlretrieve
      return opener.retrieve(url, filename, reporthook, data)
    File &quot;E:\anaconda\envs\WebScraping\lib\urllib.py&quot;, line 249, in retrieve
      tfp = open(filename, 'wb')
  IOError: [Errno 13] Permission denied: './scraped_images/'
  </code></pre>