I have a bunch of convenience functions that I've been copying around
from place to place. For example, I replace the default plot() with one
that uses the 'latex' tick_formatter.

I'd like to be able to import these automatically, or at least without
having to hard-code the path in all my scripts. Right now, I have a
~/.sage/init.sage containing the following:

  import os
  import site

  # Add '~/src/sage' to our path.
  sitedir = os.path.expanduser('~/src/sage')
  site.addsitedir(sitedir)

  from mjo.all import *

which works great -- in a sage session.

But, most of my "real" code is in standalone scripts. When I do,

  $ sage foo.py

my init.sage isn't loaded. There's a workaround, of course: I can import
init.sage (or mjo.all) manually, but that's rather ugly because either,

  a) I duplicate what init.sage is already supposed to do

  b) I wind up with my local directory structure encoded in every
     project I create

Is there some way to achieve this?

See also:

  * http://trac.sagemath.org/sage_trac/ticket/3398

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to