title: how to get the absolute path to the root folder
body: <p>This is my current folder structure, and i need to get the absolute path to the root folder</p>
  
  <pre><code>.
  └── root/
      ├── api.py
      └── programexecutablefolder/
          └── mainentry.py
  </code></pre>
  
  <p>The program has to start at mainentry.py, however I need to get the path of the root folder from api.py (though the entry to api.py is through mainentry.py)</p>
  
  <p>Also <code>os.getcwd()</code> doesn't work as it will get the directory of mainentry.py</p>