environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookmanager.py
def get_notebook_object(self, notebook_id):
        """Get the NotebookNode representation of a notebook by notebook_id."""
        path = self.find_path(notebook_id)
        if not os.path.isfile(path):
            raise web.HTTPError(404, u'Notebook does not exist: %s' % notebook_id)
        info = os.stat(path)
        last_modified = datetime.datetime.utcfromtimestamp(info.st_mtime)
        with open(path,'r') as f:
            s = f.read()
            try:
                # v1 and v2 and json in the .ipynb files.
                nb = current.reads(s, u'json')
            except:
                raise web.HTTPError(500, u'Unreadable JSON notebook.')
        # Always use the filename as the notebook name.
        nb.metadata.name = os.path.splitext(os.path.basename(path))[0]
        return last_modified, nb
def get_notebook_object(self, notebook_id):
        path = self.find_path(notebook_id)
        if not os.path.isfile(path):
            raise web.HTTPError(404, u'Notebook does not exist: %s' % notebook_id)
        info = os.stat(path)
        last_modified = datetime.datetime.utcfromtimestamp(info.st_mtime)
        with open(path,'r') as f:
            s = f.read()
            try:
                # v1 and v2 and json in the .ipynb files.
                nb = current.reads(s, u'json')
            except:
                raise web.HTTPError(500, u'Unreadable JSON notebook.')
        # Always use the filename as the notebook name.
        nb.metadata.name = os.path.splitext(os.path.basename(path))[0]
        return last_modified, nb
def get_notebook_object ( self , notebook_id ) : path = self . find_path ( notebook_id ) if not os . path . isfile ( path ) : raise web . HTTPError ( 404 , u'Notebook does not exist: %s' % notebook_id ) info = os . stat ( path ) last_modified = datetime . datetime . utcfromtimestamp ( info . st_mtime ) with open ( path , 'r' ) as f : s = f . read ( ) try : # v1 and v2 and json in the .ipynb files. nb = current . reads ( s , u'json' ) except : raise web . HTTPError ( 500 , u'Unreadable JSON notebook.' ) # Always use the filename as the notebook name. nb . metadata . name = os . path . splitext ( os . path . basename ( path ) ) [ 0 ] return last_modified , nb
Get the NotebookNode representation of a notebook by notebook_id.
Get the NotebookNode representation of a notebook by notebook_id .