加载.ipynb文件的Jupyter Notebook错误

时间:2018-11-13 15:16:37

标签: python json jupyter-notebook

Unreadable Notebook: /home/gerbil/ws_sim/src/rosie_simulation/analysis/get_stats-multi.ipynb NotJSONError('Notebook does not appear to be JSON: u\'{\\n "cells": [\\n {\\n "cell_type": "...',)

尝试加载使用jupyter notebook get_stats-multi.ipynb命令打开的.ipynb文件时,出现此错误。

{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Welcome to the metrics document! Please press \"Shift+Enter\" in the cell below to get started! *Please note that any output that is truncated can be fully expanded by clicking on the whitespace to the left of it's respective cell, underneath the ln [#]!"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "from rosie_analytics_functions import *"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Data Preparation"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### If you'd like to see all of your available logs, press \"Shift+Enter\" on the cell below "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
   "scrolled": true
   },
   "outputs": [],
   "source": [
   "!ls ./logs/raw"
   ]
   },
   {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
   "### Please enter the name of the folder where the bags to be processed are located as well as the name of the room it was running in from among (\"IEC\", \"IEC_Multi_Room\", \"IHOS_Section\", or \"IHOS_Section_3_room")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
   "scrolled": true
   },
   "outputs": [],
   "source": [
   "folder_name" = "\"test\" # Leaving this blank processes all files in logs/raw\n",
   "room_name" = "IEC"
   ]
  },
   {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
   "### Please press \"Shift+Enter\" below to generate result data and CSV files (found in analysis/logs/processed)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
   "scrolled": true
   },
   "outputs": [],
   "source": [
   "process_all_bags_in_folder(folder_name, room_name)"
   ]
  },
   {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
   "###    "
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
  "display_name": "Python 2",
  "language": "python",
  "name": "python2"
  },
  "language_info": {
  "codemirror_mode": {
  "name": "ipython",
  "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}

这是我要加载的文件。据我所知,它符合文件的JSON语法,但是我对JSON的了解很少,而且我可能会遗漏一些小东西……

1 个答案:

答案 0 :(得分:0)

开头
"### Please ... ... ... or \"IHOS_Section_3_room")"

最后是:

   "folder_name" = "\"test\"

引号不匹配,导致无法解释的JSON。除其他错误外,解决此问题应使笔记本成为一个快乐的露营者。