title: create a file outside the directory in python
body: <p>I want to create a file outside the current working directory in python. Here's my directory structure.</p>
  
  <pre><code>|--myproject
  |   |-- gui
  |   |   |-- modules
  |   |   |   |-- energy
  |   |   |   |   |-- configuration
  |   |   |   |   |   |-- working_file.py
  |   |-- service
  |   |   |-- constants
  |   |   |   |-- global_variables.json    
  </code></pre>
  
  <p>I'm current working in <code>/myproject/gui/energy/configuration/working_file.py</code> and I want to create a file under <code>/myproject/service/constants</code> named <code>global_variables.json</code></p>
  
  <p>I tried </p>
  
  <pre><code>with open("../../../../../service/constants/global_variables.json", 'w') as file_handler:
          content = json.load(file_handler)
  </code></pre>