title: Set ipython notebook working directory to notebook location
body: <p>I am wondering if there is a way to set the working directory of an ipython/jupyter notebook to the current location of the ipynb file. Something along the lines of </p>
  
  <pre><code>    SetDirectory[NotebookDirectory[]]
  </code></pre>
  
  <p>in mathematica or</p>
  
  <pre><code>    os.chdir(os.path.abspath(os.path.dirname(__file__))
  </code></pre>
  
  <p>in python. The issue is that the __file__ variable is not defined in an ipython notebook, or at least doesn't seem to be.</p>