Ask Your Question
1

@fork decorator not recognized in script

asked 2013-10-19 06:42:38 +0100

R Altman gravatar image

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!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2013-10-19 06:57:30 +0100

tmonteil gravatar image

You should add the following line at the beginning of your script:

from sage.all import *
edit flag offensive delete link more
0

answered 2013-10-19 08:41:17 +0100

R Altman gravatar image

When 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...

edit flag offensive delete link more

Comments

There 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 ?

tmonteil gravatar imagetmonteil ( 2013-10-19 09:15:39 +0100 )edit

Yes, 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.

R Altman gravatar imageR Altman ( 2013-10-19 16:54:23 +0100 )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: 2013-10-19 06:42:38 +0100

Seen: 429 times

Last updated: Oct 19 '13