--
You received this message because you are subscribed to a topic in the Google Groups "sage-devel" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-devel/CriQpiwWRLA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sage-devel+...@googlegroups.com.
To post to this group, send email to sage-...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.
On 2015-01-18, Jernej Azarija <azi.s...@gmail.com> wrote:
> The thing is that sys.exit works pretty much the same way
>
>====
> azi@goodegg:~$ cat foo.sage
> import sys
> sys.exit(42)
> azi@goodegg:~$ sage foo.sage
> 42
> azi@goodegg:~$ echo $?
> 1
>====
>
> And the print itself is extremely annoying. I need to call Sage 10^6 times
> from an external program and get 10^6 lines of non-needed output.
this looks pretty bad, given that Sage's startup+exit time is 1 or 2 seconds
on a reasoably fast computer.
(unless your computations are still much slower, of course).
There should be ways to communicate with Sage without quitting in.
On Sun, Jan 18, 2015 at 5:02 PM, Dima Pasechnik <dim...@gmail.com> wrote:On 2015-01-18, Jernej Azarija <azi.s...@gmail.com> wrote:
> The thing is that sys.exit works pretty much the same way
>
>====
> azi@goodegg:~$ cat foo.sage
> import sys
> sys.exit(42)
> azi@goodegg:~$ sage foo.sage
> 42
> azi@goodegg:~$ echo $?
> 1
>====
>
> And the print itself is extremely annoying. I need to call Sage 10^6 times
> from an external program and get 10^6 lines of non-needed output.
this looks pretty bad, given that Sage's startup+exit time is 1 or 2 seconds
on a reasoably fast computer.
(unless your computations are still much slower, of course).
There should be ways to communicate with Sage without quitting in.I agree. I ended up writing the output to a file and parsing it within the caller. Still pretty ugly and inefficient but it works.Though this still does not answer the question - why is Sage printing the exit status and not conforming to the standard behaviour of unix programs?
Nice catch! Alternatively:
* use a .py extension (that way there will not be any preparsing)
* write sys.exit(int(42r))