%%javascriptvar nb = Jupyter.notebook;var port = window.location.port;//nb.kernel.execute("NB_NAME = '" + nb.notebook_name + "'");nb.kernel.execute("NB_Port = '" + port + "'");# Get file path of this notebookconnection_file_path = kernel.get_connection_file()connection_file = os.path.basename(connection_file_path)kernel_id = connection_file.split('-', 1)[1].split('.')[0]sessions = json.load(urllib2.urlopen('http://127.0.0.1:'+NB_Port+'/api/sessions'))for sess in sessions: if sess['kernel']['id'] == kernel_id: nb_rel_path = (sess['notebook']['path']) breakres = !echo ~nb_path = os.path.join(res[0],nb_rel_path)nb_pathnb_dir,nb_filename = os.path.split(nb_path)sessions = ValueError: No JSON object could be decodedsessions = json.load(urllib2.urlopen('http://127.0.0.1:'+NB_Port+'/api/sessions?token=e72d0fdd7891272a7db87f391c00dfead81a8659f43a917e'))
--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/e3df37c0-2c21-480a-85f1-590439710329%40googlegroups.com.
%%javascriptvar nb = Jupyter.notebook;var port = window.location.port;//nb.kernel.execute("NB_NAME = '" + nb.notebook_name + "'");nb.kernel.execute("NB_Port = '" + port + "'");# Get security token# Get list of running notebooks. This gives the security token as parts of the # URL of each notebook. Assume notebook of interest is first item in the list (skip header).nb_list = %sx jupyter notebook listurl=nb_list[1]token=url.split('token=')[1].split(' ')[0]# Get file path of this notebookconnection_file_path = kernel.get_connection_file()connection_file = os.path.basename(connection_file_path)kernel_id = connection_file.split('-', 1)[1].split('.')[0]sessions = json.load(urllib2.urlopen('http://127.0.0.1:'+NB_Port+'/api/sessions?token='+token))for sess in sessions: if sess['kernel']['id'] == kernel_id: nb_rel_path = (sess['notebook']['path']) breakres = !echo ~nb_path = os.path.join(res[0],nb_rel_path)nb_pathnb_dir,nb_filename = os.path.split(nb_path)BTW, I could not find those "release notes" you mention, documenting /api/sessions. Care to point me to the correct location?