Ask Your Question
2

How to add path on sage startup

asked 2012-04-11 07:00:17 +0100

twch gravatar image

Hi,

Is there a possibility to add a user defined path to the standard sage paths? I can add the path by typing

sage: import sys

sage: sys.path.append('mypath')

and everything works fine. But I don't like to do it all the times by hand but rather have the path added as standard.

I thougth about writing a bash wrapper skript but

export PATH=$PATH:mypath

seems to have no effect and be overwritten after sage startup.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2012-04-11 10:09:54 +0100

niles gravatar image

updated 2012-04-11 10:33:01 +0100

If you are adding this directory to your path so that you can load files from it, you can use the environment variable LOAD_ATTACH_PATH. It is described in the section about the preparser in the reference manual.

If you want to modify the path for some other reason, or execute other shell commands on startup, you could use the answer posted to this question:

http://ask.sagemath.org/question/1072...

edit flag offensive delete link more

Comments

The second proposal worked fine. I just created a file init.sage in $HOME/.sage with the following content import sys sys.path.append('/usr/local/root/lib') The other proposal seems not to work for me since I want to import a module from the attached path and not load or attach a file.

twch gravatar imagetwch ( 2012-04-11 11:09:30 +0100 )edit

The first reference link should now point here http://doc.sagemath.org/html/en/refer...

j.c. gravatar imagej.c. ( 2018-06-07 16:53:33 +0100 )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

Stats

Asked: 2012-04-11 07:00:17 +0100

Seen: 3,120 times

Last updated: Apr 11 '12