William Stein wrote: > On Sat, Jan 3, 2009 at 4:15 PM, gerhard <[email protected]> wrote: >> What I am after is to interact with sage from yet another language. >> To do so, I need to start python from my own code. >> Interestingly, when I invoke the python interpreter, >> I do have access to all of the sage functionality, >> as well as commands added by my code, e.g., >> sage: foo >> <module 'foo' (built-in)> >> >> sage: foo.invoke_test( float(3.), int(5) ) >> 243 >> >> Invoking the notebook from the python prompt also works: >> I can carry out computations from the notebook as before, >> but I no longer have access to the added commands: >> sage: foo >> NameError: name 'foo' is not defined >> >> Shutting down the notebook returns me to the >> command line interpreter and everything works as before. >> >> At a guess, I interact with a vanilla python process from the >> notebook, >> so I am missing some mods I have to do to some code somewhere? > > When you run the notebook and interact with it, you're interacting > with a new vanilla python process, which has the sage library > pre-loaded. In fact, every single worksheet you start has its own > separate Python process. >
Maybe I misspoke in my other reply. Is the worksheet process a vanilla python process or an actual Sage process (with the preparser, etc.)? Will putting something in the init.sage file affect new notebook processes? Jason --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
