Ask Your Question
1

Get Sage output on Python 2.7 without writing files [closed]

asked 2016-08-12 02:26:23 -0500

Byungyun Jeon gravatar image

updated 2016-08-16 12:51:06 -0500

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?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Byungyun Jeon
close date 2016-08-17 14:20:23.367181

1 answer

Sort by ยป oldest newest most voted
1

answered 2016-08-16 17:26:21 -0500

What do you mean, sage -python is not for 2.7? Sage's Python is Python 2.7.10.

Upgrading to Python 2.7.12 is the object of Sage trac ticket #19735 and upgrading to Python 3 is the object of Sage trac ticket #16052.

edit flag offensive delete link more

Comments

@slelievre: Thanks for comments. I meant python 2.7.12. In my old sage, it was 2.6.4. I didn't know that the latest sage has 2.7.10. I closed this question.

Byungyun Jeon gravatar imageByungyun Jeon ( 2016-08-17 14:18:38 -0500 )edit

What version of Sage did you have? You should install SageMath 7.3.

slelievre gravatar imageslelievre ( 2016-08-18 03:43:51 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2016-08-12 02:26:23 -0500

Seen: 110 times

Last updated: Aug 16 '16