Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

This is very weird. That particular file sagenb/notebook/notebook_object.py never gets doctested which is why this failure was never detected. The first documentation you linked to is very old - the notebook code has changed a lot in the meanwhile, with a move to flask.

One fix for the error you are getting is the following diff, applied to the sagenb repository:

diff --git a/sagenb/notebook/notebook_object.py b/sagenb/notebook/notebook_object.py
index 431b187..4574d3f 100644
--- a/sagenb/notebook/notebook_object.py
+++ b/sagenb/notebook/notebook_object.py
@@ -251,6 +251,7 @@ def test_notebook(admin_passwd, secure=False, directory=None, port=8050,
         sage: from sagenb.notebook.notebook_object import test_notebook
         sage: passwd = str(randint(1,1<<128))
         sage: nb = test_notebook(passwd, interface='localhost', port=8060)
+        Executing twistd ...
         sage: import urllib
         sage: h = urllib.urlopen('http://localhost:8060')
         sage: homepage = h.read()
@@ -270,9 +271,7 @@ def test_notebook(admin_passwd, secure=False, directory=None, port=8050,
         os.makedirs(directory)

     nb = _notebook.load_notebook(directory)
-    nb.set_accounts(True)
-    nb.add_user('admin', admin_passwd, '')
-    nb.set_accounts(False)
+    nb.create_default_users(admin_passwd)
     nb.save()

     p = notebook(directory=directory, accounts=True, secure=secure, port=port,

After applying this patch, the file notebook_object.py passes all doctests. But it doesn't seem possible to run the following command anymore:

sage: login_page = get_url('http://localhost:%s/simple/login?username=admin&password=%s' % (port, passwd))

I don't see the /simple path in the current notebook code. So, you will have to find some other way of logging in.

The better option for you might be to use the sage cell server. See this page for examples.