Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

working directory for load/attach


Is there a command to change the current working directory inside sage, so that the load (or attach) command uses that directory as base?


I have the following file-directory-situtation:

  • directory project-base
    • file blub.sage (contains some useful functions)
    • file run.sage (contains a load blub.sage command)

To start the project i call sage run.sage in the directory project-base. Everything works fine.

If I now want to run the project from any other directory with sage path/project-base/run.sage, I get the error message, that the file tools.sage is not found. The error message is kind of clear, because in run.sage the file is loaded without any directory specifications.

A similar problem occours, when you want to call run.sage from the browser-notebook-interface.

Is there any possibility to solve this problem (except using absolute paths everywhere (which is clearly not a satisfying solution) or changing the directory structure or using soft-links)?