title: Python "IOError: [Errno 21] Is a directory: '/home/thomasshera/Pictures/Star Wars'"
body: <p>NOTE: the first part of "code" isn't code, it's error message from terminal, SE made me format it that way.</p>
  
  <p>Linux machine using Python 2.7.6</p>
  
  <p>I have download automator which is supposed to take clipboard contents (this works) and download them (this doesn't work). Here is error message:</p>
  
  <pre class="lang-sh prettyprint-override"><code>Traceback (most recent call last):
  
  File "/home/thomasshera/Create polynomial from random sequence.py", line 6, in &lt;module&gt;
  
  urllib.urlretrieve(text_in_clipboard, "/home/thomasshera/Pictures/Star Wars")
  File "/usr/lib/python2.7/urllib.py", line 94, in urlretrieve
  
  return _urlopener.retrieve(url, filename, reporthook, data)
  File "/usr/lib/python2.7/urllib.py", line 244, in retrieve
  tfp = open(filename, 'wb')
  IOError: [Errno 21] Is a directory: '/home/thomasshera/Pictures/Star Wars'
  </code></pre>
  
  <p>Here is code:</p>
  
  <pre class="lang-python prettyprint-override"><code>import Tkinter
  import urllib
  root = Tkinter.Tk()
  root.withdraw() # Hide the main window (optional)
  text_in_clipboard = root.clipboard_get()
  urllib.urlretrieve(text_in_clipboard, "/home/thomasshera/Pictures/Star Wars")
  </code></pre>
  
  <p>This would be straightforward to fix using Python shell except that there is no line 94 of my program- the shell is somehow wrong?</p>