title: Python raising NotADirectoryError
body: <p>I'm trying to raise an error when a directory does not exist, before I open files in that directory. According to <a href="https://stackoverflow.com/questions/2052390/manually-raising-throwing-an-exception-in-python/24065533#24065533">this response</a> I should use the most specific Exception constructor for my issue, which I think is <code>NotADirectoryError</code>. But running the code below I get <code>NameError: global name 'NotADirectoryError' is not defined</code>. Thanks in advance for any help!</p>
  
  <pre><code>import os
  if not os.path.isdir(baselineDir):
    raise NotADirectoryError("No results directory for baseline.")
  </code></pre>
  
  <p>And if there's a better way to do this please suggest it, thanks.</p>