Ask Your Question
0

Sage and python subprocess

asked 2015-09-19 10:11:30 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

Just installed sage-6.8

From python program I run the following command:

res = check_output(["/opt/mathenv/sage-6.8/sage","/opt/mathenv/mathsite/mathsite/scripts/eq_solver.sage","x-5", "x",'-oo', '1', 'oo', '1', '14'])

But this piece of code gives me the following error:

CalledProcessError: Command '['/opt/mathenv/sage-6.8/sage', '/opt/mathenv/mathsite/mathsite/scripts/eq_solver.sage', 'x-5', 'x', '-oo', '1', 'oo', '1', '14']' returned non-zero exit status 1

It works perfectly if I enter the command directly in shell, so there are no errors with the script.

I've managed to get the error:

Setting permissions of DOT_SAGE directory so only you can read and write it.
os.chmod(DOT_SAGE, _desired_mode)\nOSError: [Errno 1]
Operation not permitted: \'/var/www/.sage/'

How can I fix it?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-09-19 10:29:44 -0500

Hello,

The problem is explicit: you do not have write access to the repository /var/www/.sage/. Under which user are you launching python? It might be that this user has a home configured to be /var/www/ but has no write access to it.

Vincent

edit flag offensive delete link more

Comments

Sorry, I'm newbie to this. How can I check it? I actually deployed django site and I logged in as root.

proy gravatar imageproy ( 2015-09-19 11:36:27 -0500 )edit

Managed to fix it. I ran script as www-data, so chown -R www-data /root/.sage and same for /var/www/ fixed the problem.

proy gravatar imageproy ( 2015-09-19 12:42:51 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-09-19 10:11:30 -0500

Seen: 266 times

Last updated: Sep 19 '15