Ask Your Question
1

How to add path on sage startup

asked 2012-04-11 00:00:17 -0500

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
1

answered 2012-04-11 03:09:54 -0500

niles gravatar image

updated 2012-04-11 03:33:01 -0500

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 04:09:30 -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

Stats

Asked: 2012-04-11 00:00:17 -0500

Seen: 1,438 times

Last updated: Apr 11 '12