Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can add the following lines to the top of run.sage in order to change the current directory to path/project-base

import os
os.chdir(os.path.dirname(__file__))

How it works is that when you run sage path/project-base/run.sage, it converts run.sage into a Python module run.py. Within that module __file__ is a special global variable which is automatically set to the absolute path of that module.