Joseph Noirre
Joseph Noirre

Reputation: 387

Jupyter Notebook starting directly invalid character in indentifier

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!

Upvotes: 1

Views: 677

Answers (1)

Nathan Vērzemnieks
Nathan Vērzemnieks

Reputation: 5603

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.

Upvotes: 2

Related Questions