将文件扩展名添加到jupyterlab电子表格

时间:2019-03-01 15:32:18

标签: node.js jupyter-lab

我发现了一个很棒的jupyterlab扩展程序,可以打开xls,xlsx和csv文件(jupyterlab-spreadsheet)。 我经常使用制表符分隔的文件,并在文件的末尾添加一个额外的标题行,以.acq结尾。 用.csv扩展名重命名文件我可以在Open With菜单中选择Spreadsheet扩展名。除默认的csv-viewer以外,该文件已打开并正确显示。 尝试添加所需的文件扩展名时,我以zip文件的形式下载了存储库内容,将其解压缩到工作文件夹中,并通读了文件,然后将文件扩展名添加到index.ts文件中:

app.docRegistry.addFileType({
    name: "excel",
    displayName: "Excel Workbook",
    fileFormat: "base64",
    extensions: [
        ".xls",
        ".xlsx",
        ".acq",
        ".atc",
        ".ats",
        ".atr"
    ],
    mimeTypes: [
        "application/octet-stream",
        "text/plain"
    ]
});

然后我尝试使用

进行安装
yarn install
yarn build
jupyter labextension install .

启动jupyterhub并尝试连接时,我收到以下消息:

[I 2019-03-01 16:01:51.222 JupyterHub spawner:1100] Spawning jupyter-labhub --port=53857
**Note: Removing dead /root/buildingfromsource/jupyterlab-spreadsheet-master "jupyterlab-spreadsheet"
Traceback (most recent call last):
  File "/opt/anaconda3/bin/jupyter-labhub", line 7, in <module>
    from jupyterlab.labhubapp import main
  File "/opt/anaconda3/lib/python3.7/site-packages/jupyterlab/labhubapp.py", line 2, in <module>
    from .labapp import LabApp
  File "/opt/anaconda3/lib/python3.7/site-packages/jupyterlab/labapp.py", line 37, in <module>
    app_version = get_app_version()
  File "/opt/anaconda3/lib/python3.7/site-packages/jupyterlab/commands.py", line 348, in get_app_version
    handler = _AppHandler(app_dir)
  File "/opt/anaconda3/lib/python3.7/site-packages/jupyterlab/commands.py", line 386, in __init__
    self.info = self._get_app_info()
  File "/opt/anaconda3/lib/python3.7/site-packages/jupyterlab/commands.py", line 812, in _get_app_info
    info['local_extensions'] = self._get_local_extensions()
  File "/opt/anaconda3/lib/python3.7/site-packages/jupyterlab/commands.py", line 1108, in _get_local_extensions
    return self._get_local_data('local_extensions')
  File "/opt/anaconda3/lib/python3.7/site-packages/jupyterlab/commands.py", line 1243, in _get_local_data
    self._write_build_config(config)
  File "/opt/anaconda3/lib/python3.7/site-packages/jupyterlab/commands.py", line 1204, in _write_build_config
    with open(target, 'w') as fid:
PermissionError: [Errno 13] Permission denied: '/opt/anaconda3/share/jupyter/lab/settings/build_config.json'

完全没有使用nodejs的经验,我想知道更改index.ts是否是正确的开始。 我是否错过了我应该做的其他事情? 可以在配置文件中交替设置文件扩展名吗?

0 个答案:

没有答案