On Mon, Aug 25, 2008 at 11:01 PM, Simon King
<[EMAIL PROTECTED]> wrote:
>
> Dear William
>
> On Aug 26, 5:09 am, "William Stein" <[EMAIL PROTECTED]> wrote:
>> Do no  do selective imports...   Sage absolutely will not work
>> that way, since the order of module imports is critically important.
>> You must import sage.all.
>>
>> This isn't documented and goes somewhat contrary to other Python
>> libraries.  It should I think be added to the FAQ at least, and the
>> developer's guide.
>
> Then i was extremely lucky: I always did selective imports, and it
> worked :-)
>

Here is the typical sort of thing that happens if you don't import
sage.all as you should.  Note the segfault and all:

teragon-2:~ was$ sage -ipython
Python 2.5.2 (r252:60911, Jul 10 2008, 00:31:06)
Type "copyright", "credits" or "license" for more information.

In [1]: from sage.rings.polynomial.multi_polynomial_libsingular import *
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
/Users/was/real_mpfr.pyx in sage.rings.real_mpfr.RealField.__init__
(sage/rings/real_mpfr.c:3098)()
NameError: MY_MPFR_PREC_MAX
In [2]:
Do you really want to exit ([y]/n)? y
------------------------------------------------------------
Unhandled SIGBUS: A bus error occured in SAGE.
------------------------------------------------------------


-------------

It is also a *very* good idea to call

  sage.all.quit_sage()

before your program terminates, by the way.  Otherwise, you
can potentially leave maxima, etc., processes running in the
background (though it's unlikely).  See the difference below.

teragon-2:~ was$ sage -ipython
Python 2.5.2 (r252:60911, Jul 10 2008, 00:31:06)
Type "copyright", "credits" or "license" for more information.

IPython 0.8.2 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object'. ?object also works, ?? prints more.

In [1]: import sage.all
sage.all
In [2]: sage.all.maxima('2+2')
Out[2]: 4

In [3]:
Do you really want to exit ([y]/n)? y
teragon-2:~ was$ sage -ipython
Python 2.5.2 (r252:60911, Jul 10 2008, 00:31:06)
Type "copyright", "credits" or "license" for more information.

IPython 0.8.2 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object'. ?object also works, ?? prints more.

In [1]: import sage.all

In [2]: sage.all.maxima('2+2')
Out[2]: 4

In [3]: sage.all.quit_sage()
Exiting SAGE (CPU time 0m0.03s, Wall time 0m6.35s).
Exiting spawned Maxima process.

In [4]:
Do you really want to exit ([y]/n)? y
teragon-2:~ was$

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to