Here is a solution I found after much searching. It really should not be 
that hard. I hope it helps somebody. If anybody has a simpler solution, 
preferably Python-only, please let us know!
Note: Python2. 

In a separate cell:

%%javascript
var kernel = IPython.notebook.kernel;
var thename = window.location.href;
var command = "notebook_url = " + "'"+thename+"'";
kernel.execute(command);

in the next cell:

import urllib2
nb_filename = urllib2.url2pathname(notebook_url).split('/')[-1]
if nb_filename.endswith('#'):
    nb_filename = nb_filename[:-1]


I have no idea why I am getting the '#' character at the end. 

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jupyter/f0b7eaeb-7cae-430c-b69b-96c82176e0ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to