Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

This is very weird. That particular file sagenb/notebook/ 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/ b/sagenb/notebook/
index 431b187..4574d3f 100644
--- a/sagenb/notebook/
+++ b/sagenb/notebook/
@@ -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 =
@@ -270,9 +271,7 @@ def test_notebook(admin_passwd, secure=False, directory=None, port=8050,

     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)

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

After applying this patch, the file 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.