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.Sat, 19 Sep 2015 19:42:51 +0200Sage and python subprocesshttps://ask.sagemath.org/question/29499/sage-and-python-subprocess/ 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?Sat, 19 Sep 2015 17:11:30 +0200https://ask.sagemath.org/question/29499/sage-and-python-subprocess/Answer by vdelecroix for <p>Just installed sage-6.8</p>
<p>From python program I run the following command:</p>
<pre><code>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'])
</code></pre>
<p>But this piece of code gives me the following error: </p>
<pre><code>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
</code></pre>
<p>It works perfectly if I enter the command directly in shell, so there are no errors with the script.</p>
<p>I've managed to get the error:</p>
<pre><code>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/'
</code></pre>
<p>How can I fix it?</p>
https://ask.sagemath.org/question/29499/sage-and-python-subprocess/?answer=29501#post-id-29501Hello,
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.
VincentSat, 19 Sep 2015 17:29:44 +0200https://ask.sagemath.org/question/29499/sage-and-python-subprocess/?answer=29501#post-id-29501Comment by proy for <p>Hello,</p>
<p>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.</p>
<p>Vincent</p>
https://ask.sagemath.org/question/29499/sage-and-python-subprocess/?comment=29502#post-id-29502Sorry, I'm newbie to this. How can I check it? I actually deployed django site and I logged in as root.Sat, 19 Sep 2015 18:36:27 +0200https://ask.sagemath.org/question/29499/sage-and-python-subprocess/?comment=29502#post-id-29502Comment by proy for <p>Hello,</p>
<p>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.</p>
<p>Vincent</p>
https://ask.sagemath.org/question/29499/sage-and-python-subprocess/?comment=29503#post-id-29503Managed to fix it. I ran script as www-data, so chown -R www-data /root/.sage and same for /var/www/ fixed the problem.Sat, 19 Sep 2015 19:42:51 +0200https://ask.sagemath.org/question/29499/sage-and-python-subprocess/?comment=29503#post-id-29503