On Saturday, January 17, 2015 at 10:28:22 AM UTC-8, Jernej Azarija wrote:
>
> Hello,
>
> I have to use Sage from an external comand and in order to do so I'll need 
> to rely on the exit status given by Sage. Considering a trivial example
>
> =============
> $ cat foo.sage
> exit(0)
> =============
>
>
> I get the following behaviour
>
>
> =============
> $ sage la.sage
> 0
> $ echo $?
> 1
> =============
>
> There are two things I am confused with here.
>
> 1. Why do we print 0? 
>

> 2. Why is the exit status 1 - indicating an error by UNIX standards?
>
>
> Is there any reason behind this? If yes , what would be the best way to 
> force my own exit status so that I can interpret the execution of Sage from 
> an external program? 
>

The underlying problem is that the "exit" function in Python doesn't accept 
any arguments, so "exit(0)" raises an error when you run it in Sage. This 
is why the exit status is nonzero. If your script had the line "exit()", it 
would run as expected. Given that, I'm not sure why it prints 0. If you do 
"exit(3)", it will print 3 instead.

-- 
John

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to