Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Get Sage output on Python 2.7 without writing files

I have Python 2.7 codes and I know that a random Python cannot use Sage as a Python library.

Without using "sage -python" or writing script, is there a way to get Sage output on my Python?

Get Sage output on Python 2.7 without writing files

I have Python 2.7 codes and I know that a random Python cannot use Sage as a Python library.library. So I made a script .sage in Python 2.7 and ran check_output command as follows.

from subprocess import check_output 
def sage_code_run(var)
    file = open("/path/to/file.sage", 'w')
    data = "sage codes with input %s" % var
    file.write(data)
    file.close()
    return check_output(["sage", "file.sage"])

Without using It works well, but it makes delay because of writing files. And I know "sage -python" or writing script, is -python", but it's not for 2.7. Is there a way to get Sage output on my Python?Python 2.7?

Get Sage output on Python 2.7 without writing files

I have Python python 2.7 codes and I know that a random Python python cannot use Sage sage as a Python python library. So I made a script .sage in Python python 2.7 and ran check_output command as follows.

from subprocess import check_output 
def sage_code_run(var)
    file = open("/path/to/file.sage", 'w')
    data = "sage codes with input %s" % var
    file.write(data)
    file.close()
    return check_output(["sage", "file.sage"])

It works well, but it makes delay because of writing files. And I know "sage -python", but it's not for 2.7. Is there a way to get Sage sage output on Python 2.7?python?

click to hide/show revision 4
retagged

Get Sage output on Python 2.7 without writing files

I have python 2.7 codes and I know that a random python cannot use sage as a python library. So I made a script .sage in python 2.7 and ran check_output command as follows.

from subprocess import check_output 
def sage_code_run(var)
    file = open("/path/to/file.sage", 'w')
    data = "sage codes with input %s" % var
    file.write(data)
    file.close()
    return check_output(["sage", "file.sage"])

It works well, but it makes delay because of writing files. And I know "sage -python", but it's not for 2.7. Is there a way to get sage output on python?

click to hide/show revision 5
retagged

Get Sage output on Python 2.7 without writing files

I have python 2.7 codes and I know that a random python cannot use sage as a python library. So I made a script .sage in python 2.7 and ran check_output command as follows.

from subprocess import check_output 
def sage_code_run(var)
    file = open("/path/to/file.sage", 'w')
    data = "sage codes with input %s" % var
    file.write(data)
    file.close()
    return check_output(["sage", "file.sage"])

It works well, but it makes delay because of writing files. And I know "sage -python", but it's not for 2.7. Is there a way to get sage output on python?