diff --git a/IPython/html/services/notebooks/filenbmanager.py b/IPython/html/services/notebooks/filenbmanager.py
index 2f841eb..b5693e1 100644
--- a/IPython/html/services/notebooks/filenbmanager.py
+++ b/IPython/html/services/notebooks/filenbmanager.py
@@ -92,6 +92,11 @@ class FileNotebookManager(NotebookManager):
i = i+1
return name
+ def os_path_exists(self, path):
+ """Check that the given file system path is valid on this machine."""
+ if os.path.exists(path) is False:
+ raise web.HTTPError(404, "No file or directory found.")
+
def notebook_exists(self, name, path='/'):
"""Returns a True if the notebook exists. Else, returns False.
diff --git a/IPython/html/services/notebooks/tests/test_notebooks_api.py b/IPython/html/services/notebooks/tests/test_notebooks_api.py
index 50236a4..ac609b7 100644
--- a/IPython/html/services/notebooks/tests/test_notebooks_api.py
+++ b/IPython/html/services/notebooks/tests/test_notebooks_api.py
@@ -31,8 +31,8 @@ class APITest(NotebookTestBase):
#url, nb = self.mknb()
url = self.notebook_url()
nb = requests.post(url+'/')
- print nb.text
data = nb.json()
+ status = nb.status_code
assert isinstance(data, dict)
self.assertIn('name', data)
self.assertIn('path', data)
diff --git a/IPython/html/services/sessions/handlers.py b/IPython/html/services/sessions/handlers.py
index a72ed5e..081d64e 100644
--- a/IPython/html/services/sessions/handlers.py
+++ b/IPython/html/services/sessions/handlers.py
@@ -119,7 +119,7 @@ class SessionHandler(IPythonHandler):
_session_id_regex = r"(?P\w+-\w+-\w+-\w+-\w+)"
default_handlers = [
- (r"api/sessions/%s" % _session_id_regex, SessionHandler),
- (r"api/sessions", SessionRootHandler)
+ (r"/api/sessions/%s" % _session_id_regex, SessionHandler),
+ (r"/api/sessions", SessionRootHandler)
]