Ask Your Question

add users to notebook from sage commandline

asked 2012-10-17 06:22:02 -0500

mhampton gravatar image

I know I've done this before, but it was a few years ago and I can't remember exactly how I did it. Its possible that the notebook has changed in some relevant ways in the meantime.

I'd like to add a bunch of users to a notebook from the commandline. I tried something like this:

users = [['Alice','123'], ['Bob','123'], ['Carol','789']]
nb = sagenb.notebook.notebook.load_notebook('/path/to/my.sagenb/')
nbu = nb.user_manager()
for u in users:

But the users do not show up when I start the notebook.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2012-10-18 02:11:15 -0500

Dirk Danckaert gravatar image

updated 2012-10-18 02:11:39 -0500

I've been puzzling about exactly the same thing yesterday. You only have to add the line


to your script (before you start adding users). It's clearly indicated in the reference manual, but I overlooked it too.

edit flag offensive delete link more


I thought I tried that, and it didn't work. But I will try again, perhaps things get messed up if it is not done initially.

mhampton gravatar imagemhampton ( 2012-10-18 17:36:22 -0500 )edit

I tried that from scratch (starting over and inserting the "nbu.set_accounts(True)", and it still doesn't work.

mhampton gravatar imagemhampton ( 2012-10-18 17:48:59 -0500 )edit

I did essentially the same thing as you did, and it worked for me. So I'm only guessing now what else could have gone wrong. * interactively adding users only works for usernames with at least 4 characters. Mayb 'Bob' is messing things up? * I mistyped my path to the notebook. Then Sage produced a whole new notebook in the path I specified. But running the notebook took me right back to the notebook on the standard location. * I don't think mailaddresses are mandatory, but I provided them, and I see you didn't. Btw: I just noticed the path to your notebook ends in a '/'. If you did this in your script, then SAGE would have created a (hidden) .sagenb folder in that directory. Maybe you have to check this with 'ls -a'.

Dirk Danckaert gravatar imageDirk Danckaert ( 2012-10-19 10:50:44 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2012-10-17 06:22:02 -0500

Seen: 484 times

Last updated: Oct 18 '12