On Sat, May 30, 2009 at 11:10, pang <pablo.ang...@uam.es> wrote: > > > In the case where I'm using the test.sage trick, can I still import my > > own modules > > or have access to everything ? > > I guess the answer is Yes, isn't ? > > > I've tried to import both sage and pygtk without success, both in > python and sage console. Please tell me if you can achieve this. I > guess you have to install the module within sage, even if it is > installed in the system, but outside sage. >
One option that I have used is to put *.pth files inside SAGE_ROOT/local/lib/python/site-packages/ Each line in the *.pth file is the path to a directory that will be added to the search path for python modules. See SAGE_ROOT/local/lib/python/site.py for more info. Another option is to manually add python module search directories on the fly, by importing the sys module, and appending them to sys.path. For example, if you were working with a remote sage server, and you did not have access to the file system to install modules, you could upload a module to the DATA directory of a worksheet, then do: import sys sys.path.append(DATA) import your_module -- Kevin Horton Ottawa, Canada --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---