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.Wed, 20 Feb 2013 16:21:43 +0100How to convert .sage to .pyhttps://ask.sagemath.org/question/9822/how-to-convert-sage-to-py/Hi!
I created the file "example.sage" in my home directory and ran
sage: load "example.sage"
But Sage doesn't convert it to .py file, so I can't get the "example.sage.py" file. What should I do to get it? Actually, my goal is to write a GUI application, based on few sage classes. Can I do it without converting my sage code to the Python code?
Wed, 20 Feb 2013 11:51:09 +0100https://ask.sagemath.org/question/9822/how-to-convert-sage-to-py/Answer by John Palmieri for <p>Hi!</p>
<p>I created the file "example.sage" in my home directory and ran</p>
<p>sage: load "example.sage"</p>
<p>But Sage doesn't convert it to .py file, so I can't get the "example.sage.py" file. What should I do to get it? Actually, my goal is to write a GUI application, based on few sage classes. Can I do it without converting my sage code to the Python code?</p>
https://ask.sagemath.org/question/9822/how-to-convert-sage-to-py/?answer=14564#post-id-14564Running `sage --preparse example.sage` should convert `example.sage` into `example.py`.
Wed, 20 Feb 2013 13:08:39 +0100https://ask.sagemath.org/question/9822/how-to-convert-sage-to-py/?answer=14564#post-id-14564Comment by yefrem for <p>Running <code>sage --preparse example.sage</code> should convert <code>example.sage</code> into <code>example.py</code>.</p>
https://ask.sagemath.org/question/9822/how-to-convert-sage-to-py/?comment=18208#post-id-18208Thank you very much! It worked. But now when I'm trying to run this file by python interpreter an error arises
ImportError: No module named sage.all_cmdline
Wed, 20 Feb 2013 13:22:52 +0100https://ask.sagemath.org/question/9822/how-to-convert-sage-to-py/?comment=18208#post-id-18208Comment by fidbc for <p>Running <code>sage --preparse example.sage</code> should convert <code>example.sage</code> into <code>example.py</code>.</p>
https://ask.sagemath.org/question/9822/how-to-convert-sage-to-py/?comment=18207#post-id-18207I think you should run this script with the python interpreter that comes with sage.Wed, 20 Feb 2013 16:21:43 +0100https://ask.sagemath.org/question/9822/how-to-convert-sage-to-py/?comment=18207#post-id-18207