no graphics output when running python script via "sage -python"

asked 2019-07-03 03:14:41 +0200

Hi, am writing a GUI for a python module that relies on Sage packages, so it needs to run from a terminal using sage, i.e., "sage -python". In the command line version of the program everything I need works great, but when I try to launch a graphic from the GUI, nothing launches. For 2d graphics I can save them to a tmp directory, then open in the GUI or elsewhere (i.e., a workaround). But for 3d graphics, which I would like to open in a browser with the option viewer="threejs", I don't see a way to save the html file that Sage generates.

The sage documentation for threejs says "The generated HTML file contains all data for the scene apart from the JavaScript library and can be saved to disk for sharing or embedding in a web page", but I don't see any way to save the HTML file to disk. When I launch a graphic in the sage command line environment the HTML file is saved to SAGE_TMP. In the below example, no file is saved to the SAGE_TMP directory, which is presumably connected to the reason the browser does not launch the html page.

Here is a very simple example that shows that nothing is saved to the SAGE_TMP directory, and for which no graphic launches:

from sage.all import *

import os

tmp = str(sage.misc.misc.SAGE_TMP)



This returns:

Graphics3d Object

Thanks for any help anyone can give.

edit retag flag offensive close merge delete


Similar problem. Please help!

gam gravatar imagegam ( 2019-07-28 00:56:54 +0200 )edit