Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

%lsmagic seems to need some initialization not provided when starting sage (which, BTW, runs into an (invisible) IPython session). In a terminal :

charpent@zen-book-flip:~$ sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.2.beta13, Release Date: 2020-09-21              │
│ Using Python 3.8.5. Type "help()" for help.                        │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage: %lsmagic                                                                  
<IPython.core.magics.basic.MagicsDisplay object at 0x7f823866f0d0>

Failure as reported. But :

sage: %display unicode_art                                                      
sage: %lsmagic                                                                  
Available line magics:
%alias  %alias_magic  %attach  %autoawait  %autocall  %autoindent  %automagic  %axiom  %bookmark  %cat  %cd  %clear  %colors  %conda  %config  %cp  %cpaste  %crun  %debug  %dhist  %dirs  %display  %doctest_mode  %ed  %edit  %env  %fricas  %gap  %gap3  %giac  %gp  %gui  %hist  %history  %iload  %kash  %killbgscripts  %ldir  %less  %lf  %lie  %lisp  %lk  %ll  %load  %load_ext  %loadpy  %logoff  %logon  %logstart  %logstate  %logstop  %ls  %lsmagic  %lx  %macaulay2  %macro  %magic  %magma  %man  %maple  %mathematica  %matlab  %matplotlib  %maxima  %mkdir  %more  %mupad  %mv  %mwrank  %notebook  %octave  %page  %paste  %pastebin  %pdb  %pdef  %pdoc  %pfile  %pinfo  %pinfo2  %pip  %polymake  %popd  %pprint  %precision  %prun  %psearch  %psource  %pushd  %pwd  %pycat  %pylab  %quickref  %r  %recall  %rehashx  %reload_ext  %rep  %rerun  %reset  %reset_selective  %rm  %rmdir  %run  %runfile  %sage0  %save  %sc  %scilab  %set_env  %singular  %store  %sx  %system  %tb  %time  %timeit  %unalias  %unload_ext  %who  %who_ls  %whos  %xdel  %xmode

Available cell magics:
%%!  %%HTML  %%SVG  %%axiom  %%bash  %%capture  %%cython  %%debug  %%file  %%fortran  %%fricas  %%gap  %%gap3  %%giac  %%gp  %%html  %%javascript  %%js  %%kash  %%latex  %%lie  %%lisp  %%macaulay2  %%magma  %%maple  %%markdown  %%mathematica  %%matlab  %%maxima  %%mupad  %%mwrank  %%octave  %%perl  %%polymake  %%prun  %%pypy  %%python  %%python2  %%python3  %%r  %%ruby  %%sage0  %%scilab  %%script  %%sh  %%singular  %%svg  %%sx  %%system  %%time  %%timeit  %%writefile

Automagic is ON, % prefix IS NOT needed for line magics.

And now:

sage: sqrt(x)                                                                   
√x

Ditto when you start with %display ascii_art, but not when you start with %display simple.

Even more interesting, switching back to %display default DISABLES %lsmagic. Nice bug (or buglet...).

This is now Trac#30661.