1

I'm trying to change my Jupyter notebook starting directory by changing c.NotebookApp.notebook_dir

c.NotebookApp.notebook_dir = ‘/Users/kai/Box Sync/Python’

as per https://github.com/ioos/conda-recipes/wiki/Customizing-the-notebook-settings

kaichens-MacBook-Air:~ kai$ jupyter notebook
[E 12:46:24.648 NotebookApp] Exception while loading config file /Users/kai/.jupyter/jupyter_notebook_config.py
    Traceback (most recent call last):
      File "/Users/kai/anaconda3/lib/python3.6/site-packages/traitlets/config/application.py", line 562, in _load_config_files
        config = loader.load_config()
      File "/Users/kai/anaconda3/lib/python3.6/site-packages/traitlets/config/loader.py", line 457, in load_config
        self._read_file_as_dict()
      File "/Users/kai/anaconda3/lib/python3.6/site-packages/traitlets/config/loader.py", line 489, in _read_file_as_dict
        py3compat.execfile(conf_filename, namespace)
      File "/Users/kai/anaconda3/lib/python3.6/site-packages/ipython_genutils/py3compat.py", line 198, in execfile
        exec(compiler(f.read(), fname, 'exec'), glob, loc)
      File "/Users/kai/.jupyter/jupyter_notebook_config.py", line 202
        c.NotebookApp.notebook_dir = ‘/Users/kai/Box Sync/Python’
                                     ^
    SyntaxError: invalid character in identifier

Any help is appreciated!

Joseph Noirre
  • 387
  • 4
  • 20
  • Possible duplicate of [Invalid character in identifier](https://stackoverflow.com/questions/14844687/invalid-character-in-identifier) – Ron Jan 22 '18 at 17:50
  • Or of [invalid character in identifier error in Python code](https://stackoverflow.com/q/47094160/9200529). – Nathan Vērzemnieks Jan 22 '18 at 17:52

1 Answers1

2

This has nothing to do with jupyter: that character, and the one on the other end of your string, is not an ASCII apostrophe:

In [1]: str("‘")
Out[1]: '\xe2\x80\x98'

In [2]: str("'")
Out[2]: "'"

You'll need to replace both of those with apostrophes for your code to parse.

Nathan Vērzemnieks
  • 5,495
  • 1
  • 11
  • 23