Jupyter Notebook直接在标识符中启动无效字符

时间:2018-01-22 17:43:47

标签: python python-3.x jupyter-notebook jupyter

我试图通过更改c.NotebookApp.notebook_dir

来更改我的Jupyter笔记本电脑起始目录
c.NotebookApp.notebook_dir = ‘/Users/kai/Box Sync/Python’

根据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

任何帮助表示赞赏!

1 个答案:

答案 0 :(得分:1)

这与jupyter无关:该字符和字符串另一端的字符不是ASCII撇号:

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

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

您需要替换两个带撇号的代码才能解析代码。