attaching files that attach other files in the notebook

16 views
Skip to first unread message

adrian

unread,
Feb 3, 2009, 3:19:57 PM2/3/09
to sage-support
I have a folder PROGRAMS where I have two files: substitutions.sage
and morphisms.sage
The first line in substitutions.sage is
attach morphisms.sage

This works well if I cd into PROGRAMS and then run sage. This way I
can do
sage: attach substitution.sage

and everything works as expected. This is my prefered way to edit
files (I edit in Emacs, and everything works fine), and I can move the
directory around.

However, If I want to use the notebook, it uses by default the
directory ~/.sage, and I don't know of a way to change that.

I tried changing the value of DIR with no success.
I tried giving the complete path, but it always prepends ~/.sage/ to
the file morphism.sage.
Giving the full path in morphism.sage does not work either, since it
prepends ~/.sage/ to the path.
I tried changing it using ../../ but this breaks the behavior I want
to edit files using a text editor and the console.

I guess I can do a symlink into .sage, but I guess there should be a
nicer solution.

Any ideas?

Thanks.

-Adrian.

mabshoff

unread,
Feb 3, 2009, 3:27:25 PM2/3/09
to sage-support


On Feb 3, 12:19 pm, adrian <nihilalienumcr...@gmail.com> wrote:

Hi Adrian,
This sounds like a bug in attach to me, i.e. attach with an absolute
path should not prepend $DOT_SAGE. Should be easy enough to fix.

> Thanks.
>
> -Adrian.

Cheers,

Michael

Nathan Carter

unread,
Feb 3, 2009, 3:28:29 PM2/3/09
to sage-s...@googlegroups.com

Does the directory argument to notebook() do what you want? (See
notebook? for more info.)

Nathan

William Stein

unread,
Feb 3, 2009, 5:25:03 PM2/3/09
to sage-s...@googlegroups.com
On Tue, Feb 3, 2009 at 12:28 PM, Nathan Carter <nathan...@gmail.com> wrote:
>
>
> Does the directory argument to notebook() do what you want? (See
> notebook? for more info.)
>

That makes a completely separate sage notebook server whose local files
are stored in the given directory.


Michael Abshoff:


> This sounds like a bug in attach to me, i.e. attach with an absolute
> path should not prepend $DOT_SAGE. Should be easy enough to fix.

I agree that this sounds like a bug in attach.

William

adrian

unread,
Feb 3, 2009, 6:12:21 PM2/3/09
to sage-support
I just changed all to absolute paths, and called the file using an
absolute path. It works now. So I guess I made a mistake earlier.
So, I guess there are no bugs in attach.

Still, this is not a good solution to me, since that would force me to
modify all the files if I move the directory around, or change from
one computer to a different one. The best solution I did was to do the
symlinks to .sage.

I still don't understand what happens if I change the DIR variable.

Thanks. I guess my wish is to be able to change the working
directory, at least for files that are attached.

Thanks a bunch.

On Feb 3, 3:25 pm, William Stein <wst...@gmail.com> wrote:

William Stein

unread,
Feb 3, 2009, 6:30:15 PM2/3/09
to sage-s...@googlegroups.com
On Tue, Feb 3, 2009 at 3:12 PM, adrian <nihilali...@gmail.com> wrote:
>
> I just changed all to absolute paths, and called the file using an
> absolute path. It works now. So I guess I made a mistake earlier.
> So, I guess there are no bugs in attach.
>
> Still, this is not a good solution to me, since that would force me to
> modify all the files if I move the directory around, or change from
> one computer to a different one. The best solution I did was to do the
> symlinks to .sage.
>
> I still don't understand what happens if I change the DIR variable.
>
> Thanks. I guess my wish is to be able to change the working
> directory, at least for files that are attached.
>
> Thanks a bunch.

I made a ticket that I think would accomplish this:

http://trac.sagemath.org/sage_trac/ticket/5169

adrian

unread,
Feb 3, 2009, 6:37:53 PM2/3/09
to sage-support
Thanks!

I tried also to make a folder .sage inside of PROGRAMS, and, inside of
sage session:

notebook(directory=PROGRAMS/.sage)

this way I can attach files inside of programs just by doing attach
file.sage. The problem, as you mentioned above is that it cannot see
the other worksheets inside of ~/.sage, and one sets another
password...

The proposal in the ticket would certainly solve this.

Thanks a bunch.
-Adrian.

On Feb 3, 4:30 pm, William Stein <wst...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages