Hallo Tobias,
I had the same issue...and I chose to load OR to "preparse" my included
files.
In main worksheet, first cell contains:
# Load modules
#%hide
import sys
sys.path.append('./modules')
import DrawingConstants as dc
# Import SAGE modules (sage and not python, because file must be preparsed)
sage.misc.preparser.load("./modules/RationalTrigonometry.sage", globals())
# Alias from dc module
[nd] = [dc.nd]
[c0,c1,c2,c3,c4,c5,c6,c7,c8] =
[dc.c0,dc.c1,dc.c2,dc.c3,dc.c4,dc.c5,dc.c6,dc.c7,dc.c8]
where DrawingConstants.py is a Python file in directory modules of my
project with lines such as
# Colors
c0 = "white"
c1 = "black"
c2 = "red"
c3 = "green"
c4 = "brown"
c5 = "orange"
c6 = "pink"
c7 = "blue"
c8 = "yellow"
and in my loaded (and pre-parsed) SAGE file RationalTrigonometry.sage I
have for example :
print "RationalTrigonometry (RT) module loading ..."
# Given two points p1,p1 returns quadrance Q(P1,P2)
def RT_Quadrance(p1,p2):
[x1,y1] = p1; [x2,y2] = p2
q = (x1-x2)^2+(y1-y2)^2
return q
When I modify the RationalTrigonometry.sage file, I saved it, then Run the
first cell of main worksheet.
Dominique
PS : why i preparse ? it's because I use some "symbolic" code of functions
(for example: RT_Quadrance() is symbolic and I can all it with p1,p2
vectors and variable as coordinates...I coerce later (in integers, reals,
other fields..).
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.