ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 19 Oct 2013 09:54:23 -0500@fork decorator not recognized in scripthttps://ask.sagemath.org/question/10628/fork-decorator-not-recognized-in-script/I'm trying to run a test script with the @fork decorator, but it isn't being recognized. The script looks like this:
#!/home/raltman/sage-5.10/sage
@fork
def f(a):
return a;
out=f("hi");
print out;
When I run this, I get the following error message:
> Traceback (most recent call last):
> File "/home/raltman/test.sage", line
> 3, in <module>
>
>@fork
>
>NameError: name 'fork' is not defined
The same code works when I run it in the sage console, and the script itself works without the @fork decorator. I'd really appreciate any help on this!Fri, 18 Oct 2013 23:42:38 -0500https://ask.sagemath.org/question/10628/fork-decorator-not-recognized-in-script/Answer by R Altman for <p>I'm trying to run a test script with the @fork decorator, but it isn't being recognized. The script looks like this:</p>
<pre><code>#!/home/raltman/sage-5.10/sage
@fork
def f(a):
return a;
out=f("hi");
print out;
</code></pre>
<p>When I run this, I get the following error message:</p>
<blockquote>
<p>Traceback (most recent call last): <br/>
File "/home/raltman/test.sage", line
3, in <module></p>
<p>@fork</p>
<p>NameError: name 'fork' is not defined</p>
</blockquote>
<p>The same code works when I run it in the sage console, and the script itself works without the @fork decorator. I'd really appreciate any help on this!</p>
https://ask.sagemath.org/question/10628/fork-decorator-not-recognized-in-script/?answer=15539#post-id-15539When I tried this, I got the following error:
> /home/raltman/sage-5.10/sage: line
> 135: 27264 Illegal instruction (core
> dumped)
>"SAGE_ROOT/spkg/bin/sage" "$@"
I don't see why this should be an illegal instruction...Sat, 19 Oct 2013 01:41:17 -0500https://ask.sagemath.org/question/10628/fork-decorator-not-recognized-in-script/?answer=15539#post-id-15539Comment by R Altman for <p>When I tried this, I got the following error:</p>
<blockquote>
<p>/home/raltman/sage-5.10/sage: line
135: 27264 Illegal instruction (core
dumped)
"SAGE_ROOT/spkg/bin/sage" "$@"</p>
</blockquote>
<p>I don't see why this should be an illegal instruction...</p>
https://ask.sagemath.org/question/10628/fork-decorator-not-recognized-in-script/?comment=16914#post-id-16914Yes, I do think it's related to my previous question, but I thought this might be more fundamental. I installed sage using the instructions here: http://www.sagemath.org/doc/installation/source.html#general-procedure. The binary should definitely correspond to my architecture and distribution. I'm using sage as standalone in a self-contained directory /home/raltman/sage-5.10/ since I don't have administrative access. It seems to work just fine in every other context but this one.Sat, 19 Oct 2013 09:54:23 -0500https://ask.sagemath.org/question/10628/fork-decorator-not-recognized-in-script/?comment=16914#post-id-16914Comment by tmonteil for <p>When I tried this, I got the following error:</p>
<blockquote>
<p>/home/raltman/sage-5.10/sage: line
135: 27264 Illegal instruction (core
dumped)
"SAGE_ROOT/spkg/bin/sage" "$@"</p>
</blockquote>
<p>I don't see why this should be an illegal instruction...</p>
https://ask.sagemath.org/question/10628/fork-decorator-not-recognized-in-script/?comment=16915#post-id-16915There is no line 135 in your script, this is a problem in the sage script (moreover the previous script works for me when i add the import statement). It seems related to [your previous question](http://ask.sagemath.org/question/3085/sage-error-in-batch-job). How did you install sage ? Does the binary correspond to your architecture and distribution ? Did you move it to another directory ?Sat, 19 Oct 2013 02:15:39 -0500https://ask.sagemath.org/question/10628/fork-decorator-not-recognized-in-script/?comment=16915#post-id-16915Answer by tmonteil for <p>I'm trying to run a test script with the @fork decorator, but it isn't being recognized. The script looks like this:</p>
<pre><code>#!/home/raltman/sage-5.10/sage
@fork
def f(a):
return a;
out=f("hi");
print out;
</code></pre>
<p>When I run this, I get the following error message:</p>
<blockquote>
<p>Traceback (most recent call last): <br/>
File "/home/raltman/test.sage", line
3, in <module></p>
<p>@fork</p>
<p>NameError: name 'fork' is not defined</p>
</blockquote>
<p>The same code works when I run it in the sage console, and the script itself works without the @fork decorator. I'd really appreciate any help on this!</p>
https://ask.sagemath.org/question/10628/fork-decorator-not-recognized-in-script/?answer=15531#post-id-15531You should add the following line at the beginning of your script:
from sage.all import *
Fri, 18 Oct 2013 23:57:30 -0500https://ask.sagemath.org/question/10628/fork-decorator-not-recognized-in-script/?answer=15531#post-id-15531