ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 06 Jul 2018 14:02:44 +0200About sage.plot.plot.EMBEDDED_MODEhttps://ask.sagemath.org/question/42767/about-sageplotplotembedded_mode/[Cantor program](https://en.wikipedia.org/wiki/Cantor_(software)) used sage-cli, and in this program there is need to disable external viewers.
I found sage variable, which, I hope, will do it: `sage.plot.plot.EMBEDDED_MODE`.
But after setting `sage.plot.plot.EMBEDDED_MODE` to `True` I haven't any changes: external viewer starts, for example, for plots.
But in `src/sage/structure/graphics_file.py` on line 161 we have `launch_viewer` function, which, I think, start external viewer and where there is this condition:
<pre><code>
from sage.plot.plot import EMBEDDED_MODE
if EMBEDDED_MODE:
raise RuntimeError('should never launch viewer in embedded mode')
</code></pre>
So, as I see, if `sage.plot.plot.EMBEDDED_MODE` is `True`, we don't start external viewer, because we exit from function `launc_viewer` with `RuntimeError`. But sage works fine with `EMBEDDED_MODE = True`.
Could anyone explain this behavior, is it a bug with `sage.plot.plot.EMBEDDED_MODE` or I am wrong?Thu, 28 Jun 2018 21:26:31 +0200https://ask.sagemath.org/question/42767/about-sageplotplotembedded_mode/Answer by vdelecroix for <p><a href="https://en.wikipedia.org/wiki/Cantor_(software)">Cantor program</a> used sage-cli, and in this program there is need to disable external viewers.
I found sage variable, which, I hope, will do it: <code>sage.plot.plot.EMBEDDED_MODE</code>.</p>
<p>But after setting <code>sage.plot.plot.EMBEDDED_MODE</code> to <code>True</code> I haven't any changes: external viewer starts, for example, for plots.</p>
<p>But in <code>src/sage/structure/graphics_file.py</code> on line 161 we have <code>launch_viewer</code> function, which, I think, start external viewer and where there is this condition:</p>
<pre><code>
from sage.plot.plot import EMBEDDED_MODE
if EMBEDDED_MODE:
raise RuntimeError('should never launch viewer in embedded mode')
</code></pre>
<p>So, as I see, if <code>sage.plot.plot.EMBEDDED_MODE</code> is <code>True</code>, we don't start external viewer, because we exit from function <code>launc_viewer</code> with <code>RuntimeError</code>. But sage works fine with <code>EMBEDDED_MODE = True</code>.
Could anyone explain this behavior, is it a bug with <code>sage.plot.plot.EMBEDDED_MODE</code> or I am wrong?</p>
https://ask.sagemath.org/question/42767/about-sageplotplotembedded_mode/?answer=42848#post-id-42848You should be using
sage: from sage.repl.rich_output import get_display_manager
sage: dm = get_display_manager()
sage: dm.preferences.graphics='disable'
The other possibilities for graphics are `'raster'` (for png) and `'vector'` (for pdf).
The `EMBEDDED_MODE` is probably a left over of older Sage versions.
EDIT: you probably want to create a `backend_cantor.py` modeled on the various `backend_XXX.py` in `$SAGE_ROOT/src/sage/repl/rich_output/` (see e.g. on [github](https://github.com/sagemath/sage/tree/master/src/sage/repl/rich_output)).Fri, 06 Jul 2018 14:02:44 +0200https://ask.sagemath.org/question/42767/about-sageplotplotembedded_mode/?answer=42848#post-id-42848