title: Using environment variable in jupyter_notebook_config.py
body: <p>I want to use an environment variable as the location for the c.NotebookApp.notebook_dir parameter in jupyter_notebook_config.py but I have added </p>
  
  <pre class="lang-sh prettyprint-override"><code>c.NotebookApp.notebook_dir = $JUPYTER_NOTEBOOKS
  </code></pre>
  
  <p>I have also created the variable</p>
  
  <pre><code>&gt;export JUPYTER_NOTEBOOKS=/home/jupyter
  </code></pre>
  
  <p>but when I run Jupyter notebook I get the below error message and I can tell its not pulling the value of the variable and is trying to use the variable as a literal. Has anyone used environment variables successfully in jupyter notebook config?</p>
  
  <pre><code>[E 20:45:04.513 NotebookApp] Exception while loading config file /root/.jupyter/jupyter_notebook_config.py
      Traceback (most recent call last):
        File "/usr/local/lib/python3.6/site-packages/traitlets/config/application.py", line 562, in _load_config_files
          config = loader.load_config()
        File "/usr/local/lib/python3.6/site-packages/traitlets/config/loader.py", line 457, in load_config
          self._read_file_as_dict()
        File "/usr/local/lib/python3.6/site-packages/traitlets/config/loader.py", line 489, in _read_file_as_dict
          py3compat.execfile(conf_filename, namespace)
        File "/usr/local/lib/python3.6/site-packages/ipython_genutils/py3compat.py", line 198, in execfile
          exec(compiler(f.read(), fname, 'exec'), glob, loc)
        File "/root/.jupyter/jupyter_notebook_config.py", line 766
          c.NotebookApp.notebook_dir = $JUPYTER_NOTEBOOKS
                                                         ^
      SyntaxError: unexpected character after line continuation character
  [I 20:45:04.523 NotebookApp] Writing notebook server cookie secret to /root/.local/share/jupyter/runtime/notebook_cookie_secret
  Traceback (most recent call last):
    File "/usr/local/bin/jupyter-notebook", line 11, in &lt;module&gt;
      sys.exit(main())
    File "/usr/local/lib/python3.6/site-packages/jupyter_core/application.py", line 266, in launch_instance
      return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
    File "/usr/local/lib/python3.6/site-packages/traitlets/config/application.py", line 657, in launch_instance
      app.initialize(argv)
    File "&lt;/usr/local/lib/python3.6/site-packages/decorator.py:decorator-gen-7&gt;", line 2, in initialize
    File "/usr/local/lib/python3.6/site-packages/traitlets/config/application.py", line 87, in catch_config_error
      return method(app, *args, **kwargs)
    File "/usr/local/lib/python3.6/site-packages/notebook/notebookapp.py", line 1628, in initialize
      self.init_webapp()
    File "/usr/local/lib/python3.6/site-packages/notebook/notebookapp.py", line 1407, in init_webapp
      self.http_server.listen(port, self.ip)
    File "/usr/local/lib/python3.6/site-packages/tornado/tcpserver.py", line 151, in listen
      sockets = bind_sockets(port, address=address)
    File "/usr/local/lib/python3.6/site-packages/tornado/netutil.py", line 174, in bind_sockets
      sock.bind(sockaddr)
  OSError: [Errno 99] Cannot assign requested address
  </code></pre>