has2k1 / gnuplot_kernel

A Jupyter/IPython kernel for gnuplot
BSD 3-Clause "New" or "Revised" License
84 stars 25 forks source link

Warning about prompt at each cell #31

Closed agiliopadua closed 3 years ago

agiliopadua commented 3 years ago

Hi. The kernel runs fine (macOS, conda) but I get this message after running each cell:

    Warning: The prompt is currently set to '2004hgnuplot> '
    Out[*]: ?2004l

Thx.

has2k1 commented 3 years ago

What is the gnuplot prompt when you use it in the terminal?

agiliopadua commented 3 years ago

It's gnuplot>

has2k1 commented 3 years ago

Can you confirm that it is the same gnuplot that is used by the kernel. i.e. use the full path to gnuplot that is returned by this command.

$ python -c 'from metakernel import pexpect; print(pexpect.which("gnuplot"))'
/usr/bin/gnuplot
agiliopadua commented 3 years ago

Yup. I only have one installed (5.4.1 from Homebrew): /usr/local/bin/gnuplot

has2k1 commented 3 years ago

It seems like there is a weird character(s) before gnuplot>, because when gnuplot> is right-stripped from 2004hgnuplot>, the result is ?2004l!

Have you run the code anywhere else online, because there is a similar issue here and it looks to have appeared in the last day.

agiliopadua commented 3 years ago

This seems to be an escape sequence for bracketed paste mode (something I had not heard of before). I don't know how your kernel interacts with the gnuplot process (using a shell?)

agiliopadua commented 3 years ago

Just reinstalled gnuplot recompiling from source as in the page you pointed to. The issue is with the readline library. Now I no longer have those escape characters polluting the output.

has2k1 commented 3 years ago

This seems to be an escape sequence for bracketed paste mode (something I had not heard of before). I don't know how your kernel interacts with the gnuplot process (using a shell?)

First time I am hearing of bracketed paste mode too. From a somewhat long memory, the underlying libraries just spawn gnuplot as a separate process; no intermediary shell.

Now I no longer have those escape characters polluting the output.

Great.

thosef commented 3 years ago

Before compilation of the gnuplot executable, it needs to be configured to use its own readline library, with ./configure --with-readline=builtin Otherwise, at least on linux systems, GNU readline library is compiled in, which adds these additional characters.