ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 10 Jun 2015 06:43:12 -0500Organizing files in Sage Cloud/moduleshttp://ask.sagemath.org/question/27081/organizing-files-in-sage-cloudmodules/ I am working in sage cloud, in a worksheet (sagews). I wrote some classes and methods so far and I wish to keep them separated from my new code/organize my projects in files that I can import from.
I want something like
file Resources.(.py? .sage? .sagews?) with classes Foo, Foo2, Foo3
and to use this in a new spreadsheet:
<code>
from Resources import Foo2
</code>
While this seems like a basic question, the only thing I could discover on this topic was a similar unanswered question: http://ask.sagemath.org/question/26040/import-module-from-another-file-in-cloud/
How do I do this? How do I split a project in several files(modules?) that I could import from?
WizqWed, 10 Jun 2015 06:43:12 -0500http://ask.sagemath.org/question/27081/How to import 3rd party modules into SAGE?http://ask.sagemath.org/question/9754/how-to-import-3rd-party-modules-into-sage/In SAGE, I can import math or numpy from within a script, but I'm unable to import stuff located in, for example, /usr/lib/python2.7/dist-packages/. How could I fix that?
Thanks in advance.FaustoThu, 31 Jan 2013 00:38:17 -0600http://ask.sagemath.org/question/9754/How to import a module at startup?http://ask.sagemath.org/question/8929/how-to-import-a-module-at-startup/Hello, I'm new to sage and have been trying to import numpy when starting up sage for a few hours now. I've searched everywhere and so far i've tried the following options:
Editing the import_all variable in .sage/ipython/ipythonrc
import_all numpy
I've also tried adding some execute instructions in the ipythonrc
execute print "test"
execute from numpy import *
The thing is, the first line works and writes "test" to the console, but the import statement doesn't seem to work.
Finally, I've edited the main function in .sage/ipython/ipy_user_conf like this:
def main():
from numpy import *
o = ip.options
ip.ex('from numpy import *')
main()
But this doesn't seem to work either. When I try to create a new column matrix like this:
a=matrix("[1; 2; 3; 4]")
I get an error which is solved by manually importing the numpy libs.
Is there any other way to automatically load modules at startup? Am I missing something?
Thanks in advance for any help.
LevelpartWed, 25 Apr 2012 12:28:21 -0500http://ask.sagemath.org/question/8929/