Sage-4.0.2 running notebook from the command line

42 views
Skip to first unread message

Robert Miller

unread,
Jun 22, 2009, 12:38:47 PM6/22/09
to sage-devel
I tried running the Sage notebook as follows, from SAGE_ROOT/devel/
sage-main:

$ ../../sage -notebook

And I get the following error:

Please wait while the Sage Notebook server starts...
Traceback (most recent call last):
File "/Users/rlmill/sage-4.0.2/local/bin/sage-notebook", line 9, in
<module>
from sage.server.notebook.all import notebook
File "/Users/rlmill/sage-4.0.2/devel/sage-main/sage/server/notebook/
all.py", line 15, in <module>
from notebook_object import notebook, inotebook
File "/Users/rlmill/sage-4.0.2/devel/sage-main/sage/server/notebook/
notebook_object.py", line 19, in <module>
import notebook as _notebook
File "/Users/rlmill/sage-4.0.2/devel/sage-main/sage/server/notebook/
notebook.py", line 22, in <module>
from sage.structure.sage_object import SageObject, load
ImportError: No module named sage_object

Can anyone reproduce this?

William Stein

unread,
Jun 22, 2009, 12:41:34 PM6/22/09
to sage-...@googlegroups.com

In python imports are relative by default, so "import sage" does not
mean what you think. I think long ago I hacked around this problem
for just typing "sage" to start sage, by making it change to a
different directory during startup. (I vaguely recall doing that
specifically to get Sage to work on Cygwin, actually.)

So I think the above should be considered a bug, and you should
definitely report it to trac. Probably the fix is to change the
directory during part of Sage startup, to thwart Python's relative
import system.

William

Robert Miller

unread,
Jun 22, 2009, 12:42:48 PM6/22/09
to sage-devel
PS - I'm on a MacBook running OS 10.5.7, and

sage: notebook()

works fine.

Nick Alexander

unread,
Jun 22, 2009, 12:43:23 PM6/22/09
to sage-...@googlegroups.com

These recent path errors have bitten me too; always, the solution has
been to run the programs from a different directory. Looks like we
need to get to the bottom of this.

Nick

John Cremona

unread,
Jun 22, 2009, 1:19:28 PM6/22/09
to sage-...@googlegroups.com
2009/6/22 Nick Alexander <ncale...@gmail.com>:
This sounds like the same thing which makes sage -merge fail if you do
it from SAGE_ROOT/devel/sage-clone

John

>
> Nick
>
> >
>

Robert Miller

unread,
Jun 22, 2009, 1:58:58 PM6/22/09
to sage-devel

William Stein

unread,
Jun 22, 2009, 4:50:36 PM6/22/09
to sage-...@googlegroups.com

Python has always worked this way.

The problem is that if you're in a directory and it contains a
directory foo (with a file __init__.py in it), and you type into a
python session "import foo", then the code in the directory foo is
imported, even if there happens to also be a foo in site-packages.
The code in the local directory takes precedence. In the above
example, there's no sage_object, since it's a Cython module, so the
.so file doesn't exist in the sage directory (it's in the
site-packages directory).

-- William

Reply all
Reply to author
Forward
0 new messages