#693: Script to spawn a browser / start notebook.
---------------------------+------------------------------------------------
Reporter: boothby | Owner: boothby
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-4.3
Component: notebook | Keywords:
Work_issues: | Author: Tim Dumol
Reviewer: | Merged:
---------------------------+------------------------------------------------
Changes (by was):
* status: needs_review => needs_work
Comment:
I don't get it. If I do
{{{
$ sage -notebook directory=foo port=8001 &
$ sage -notebook directory=bar port=8002
}}}
then when I execute the second line it might just pop up a notebook server
pointed at port 8001. Actually, given the line:
{{{
cmd = "notebook(" + ",".join([wrap(v) for v in sys.argv[1:]]) + ",port=" +
SAGENB_PORT + ")"
}}}
I think it would give an error, since port= is specified twice.
This is because you introduced a new environment variable SAGENB_PORT
which isn't documented. I don't know why it is there. I think you should
get the port from the port= option on the command line.
I think you should get port= from the command line and get rid of the
SAGENB_PORT environment variable.
Also, you use:
{{{
DOT_SAGENB = os.environ.get('DOT_SAGENB', os.path.join(os.environ['HOME'],
'.sage', 'sage_notebook.sagenb'))
}}}
but actually, you need to use the file {{{os.path.join(D, 'twistd.pid')}}}
where D is the option specified in directory= in the command line.
Finally, I think this code should be in the notebook(...) command in Sage
itself. It's wrong putting it here in this shell script, because it only
half way fixes the problem. E.g., imagine a user that types the following
and leaves that in a console:
{{{
sage: notebook()
}}}
Then in another console, they type
{{{
sage: notebook()
}}}
Instead of giving an error, it should just given them the notebook.
If you put this code that you've just written in the notebook command,
then both problems are automatically solved, whereas with the current code
location, only half the problem is really solved.
Also, there is a notebook(fork=True) option, so one can do
{{{
sage: notebook(fork=True)
The notebook files are stored in: sage_notebook.sagenb
**************************************************
* *
* Open your web browser to http://localhost:8001 *
* *
**************************************************
<pexpect.spawn instance at 0x10bb78bd8>
sage: notebook()
# get some notebook
}}}
William
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/693#comment:3>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=.