setScilabOutputMethod - output vs error streams

classic Classic list List threaded Threaded
4 messages Options
SylvainCorlay SylvainCorlay
Reply | Threaded
Open this post in threaded view
|

setScilabOutputMethod - output vs error streams

Hello, world!

The Jupyter kernel protocol expect stdout and stderr streams to be both redirected to the frontend, however, it makes a distinction between error and output messages in the `stream` message type:
content = {
    # The name of the stream is one of 'stdout', 'stderr'
    'name' : str,

    # The text is an arbitrary string to be written to that stream
    'text' : str,
}

This is reflected graphically in web frontend. See the following screenshot for example, with the C++ Jupyter kernel:

Screenshot from 2019-03-29 18-11-44.png

I am writing a scilab Jupyter kernel with the Xeus C++ implementation of the protocol, and the redirection to the frontend is achieved through the setScilabOutputMethod function which results in both errors and outputs to be redirected in the same way.

It would be great if there was a means to specify to different functions with e.g. setScilabErrorStreamMethod and setScilabOutputStreamMethod, and keeping setScilabOutputMethod as a means to set both at once for backward compatibility.

I would love to hear your thoughts on that.

Cheers,

Sylvain

_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev
mottelet mottelet
Reply | Threaded
Open this post in threaded view
|

Re: setScilabOutputMethod - output vs error streams

Le 29/03/2019 à 18:28, Sylvain Corlay a écrit :

Hello, world!

The Jupyter kernel protocol expect stdout and stderr streams to be both redirected to the frontend, however, it makes a distinction between error and output messages in the `stream` message type:
content = {
    # The name of the stream is one of 'stdout', 'stderr'
    'name' : str,

    # The text is an arbitrary string to be written to that stream
    'text' : str,
}

This is reflected graphically in web frontend. See the following screenshot for example, with the C++ Jupyter kernel:

Screenshot from 2019-03-29 18-11-44.png

I am writing a scilab Jupyter kernel
Glad to hear that, this is a great initiative !
with the Xeus C++ implementation of the protocol, and the redirection to the frontend is achieved through the setScilabOutputMethod function which results in both errors and outputs to be redirected in the same way.

It would be great if there was a means to specify to different functions with e.g. setScilabErrorStreamMethod and setScilabOutputStreamMethod, and keeping setScilabOutputMethod as a means to set both at once for backward compatibility.

I would love to hear your thoughts on that.
Maybe Antoine could answer ?

Cheers,

Sylvain

_______________________________________________
dev mailing list
[hidden email]
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/dev

_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev
SylvainCorlay SylvainCorlay
Reply | Threaded
Open this post in threaded view
|

Re: setScilabOutputMethod - output vs error streams

Hello Everyone,

I am following up on this.

Would you guys be open to a PR making that change?

On Fri, Mar 29, 2019 at 6:56 PM Stéphane Mottelet <[hidden email]> wrote:

Le 29/03/2019 à 18:28, Sylvain Corlay a écrit :

Hello, world!

The Jupyter kernel protocol expect stdout and stderr streams to be both redirected to the frontend, however, it makes a distinction between error and output messages in the `stream` message type:
content = {
    # The name of the stream is one of 'stdout', 'stderr'
    'name' : str,

    # The text is an arbitrary string to be written to that stream
    'text' : str,
}

This is reflected graphically in web frontend. See the following screenshot for example, with the C++ Jupyter kernel:

Screenshot from 2019-03-29 18-11-44.png

I am writing a scilab Jupyter kernel
Glad to hear that, this is a great initiative !
with the Xeus C++ implementation of the protocol, and the redirection to the frontend is achieved through the setScilabOutputMethod function which results in both errors and outputs to be redirected in the same way.

It would be great if there was a means to specify to different functions with e.g. setScilabErrorStreamMethod and setScilabOutputStreamMethod, and keeping setScilabOutputMethod as a means to set both at once for backward compatibility.

I would love to hear your thoughts on that.
Maybe Antoine could answer ?

Cheers,

Sylvain

_______________________________________________
dev mailing list
[hidden email]
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/dev
_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev

_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev
Antoine ELIAS-2 Antoine ELIAS-2
Reply | Threaded
Open this post in threaded view
|

Re: setScilabOutputMethod - output vs error streams

Hello Sylvain,

I made changes on master branch. You can update your repo ( Clément has merged the PR )
Now you have 3 functions:
void setScilabOutputMethod(SCILAB_OUTPUT_METHOD writer);
void setScilabErrorStreamMethod(SCILAB_OUTPUT_METHOD writer);
void setScilabOutputStreamMethod(SCILAB_OUTPUT_METHOD writer);

First for compatibility that set the same handler for outputs and errors
Second for errors and third for outputs.

I hope that help you.

Antoine
Le 17/07/2019 à 11:51, Sylvain Corlay a écrit :
Hello Everyone,

I am following up on this.

Would you guys be open to a PR making that change?

On Fri, Mar 29, 2019 at 6:56 PM Stéphane Mottelet <[hidden email]> wrote:

Le 29/03/2019 à 18:28, Sylvain Corlay a écrit :

Hello, world!

The Jupyter kernel protocol expect stdout and stderr streams to be both redirected to the frontend, however, it makes a distinction between error and output messages in the `stream` message type:
content = {
    # The name of the stream is one of 'stdout', 'stderr'
    'name' : str,

    # The text is an arbitrary string to be written to that stream
    'text' : str,
}

This is reflected graphically in web frontend. See the following screenshot for example, with the C++ Jupyter kernel:

Screenshot from 2019-03-29 18-11-44.png

I am writing a scilab Jupyter kernel
Glad to hear that, this is a great initiative !
with the Xeus C++ implementation of the protocol, and the redirection to the frontend is achieved through the setScilabOutputMethod function which results in both errors and outputs to be redirected in the same way.

It would be great if there was a means to specify to different functions with e.g. setScilabErrorStreamMethod and setScilabOutputStreamMethod, and keeping setScilabOutputMethod as a means to set both at once for backward compatibility.

I would love to hear your thoughts on that.
Maybe Antoine could answer ?

Cheers,

Sylvain

_______________________________________________
dev mailing list
[hidden email]
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/dev
_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev

_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev


_______________________________________________
dev mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/dev