I used IPythonShellEmbed to embed python (and sage) in my own code,
and got it to work from the command line, giving me access to my own
code as a built in module.
Trying to switch to the notebook interface however looses
access to the module. Where would I need to look
to figure out what might be going wrong there?
Thanks,
-gerhard
------------------------
for reference, I initialized IPython with
import IPython
from IPython.Shell import IPShellEmbed
import os
import sys
import new
__SAGE_AUTOINJECT__ = True
ipy_sage = IPShellEmbed(argv=['-p', 'sage' ])
old_system = ipy_sage.IP.system
sage_commands = os.listdir(os.environ['SAGE_ROOT']+'/local/bin/')
DARWIN_SYSTEM = os.uname()[0]=='Darwin'
def sage_system(self, cmd):
if cmd in sage_commands:
old_system(cmd)
else:
libraries = 'LD_LIBRARY_PATH=$$SAGE_ORIG_LD_LIBRARY_PATH;'
if DARWIN_SYSTEM:
libraries += 'DYLD_LIBRARY_PATH=$
$SAGE_ORIG_DYLD_LIBRARY_PATH;'
old_system(libraries+cmd)
ipy_sage.IP.system = new.instancemethod(sage_system, ipy_sage.IP,
IPython.iplib.InteractiveShell)
ipy_sage()
--~--~---------~--~----~------------~-------~--~----~
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
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---