title: How to find parent directory in iPython
body: <p>I'm using iPython (Jupiter notebook) for visualizing my data. I planned storage my input data outside of the git repository liked that:</p>
  
  <pre><code>root/
  |- git_repository/
  |  |- research.ipynb
  |- storage/
  |  |- raw_data/
  |  |  |- example.odx
  ...
  </code></pre>
  
  <p>I tried to import <code>example.odx</code> from all storages folder (raw_data, research_data...) to my code by this code below:</p>
  
  <pre><code>In  [1]: from os import listdir
           from os.path import isdir
           files = [file for file in listdir('../storage') if isdir(file)]
  Out [1]: []
  </code></pre>
  
  <p>My output is <code>[]</code> mean I can not find my data. I tried some string path below however It still fails.</p>
  
  <pre><code>&gt;&gt;&gt; from os import path
  &gt;&gt;&gt; path.join(path.dirname(__file__), '../')
  NameError: name '__file__' is not defined
  </code></pre>
  
  <pre><code>'./../storage', '../../storage', '../', './../', './../storage/', './..', '..'
  </code></pre>