Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STDIN Support with MathLine #8

Open
rljacobson opened this issue Jul 24, 2019 · 6 comments
Open

STDIN Support with MathLine #8

rljacobson opened this issue Jul 24, 2019 · 6 comments
Assignees
Labels
enhancement New feature or request long-run Works that will be done in the unforeseen future

Comments

@rljacobson
Copy link

It will be helpful to implement a stdio channel, so that the Mathematica earlier than 11.2 will also be supported, but it is really hard to expose the stdin channel. Hope this will be dicussed in future release of Wolfram kernel.

This has been a well-known ( to people that know it) problem with Mathematica for years and is unlikely to change anytime soon. I wrote MathLine specifically to deal with this problem. It may be of help to you.

@kenkangxgwe
Copy link
Owner

Hi, please allow me some time to try out MathLine. Btw, is it portable across different platforms so I can bundle it with the server directly?

@kenkangxgwe
Copy link
Owner

I just compiled it on Windows and found that no matter what arguments I gave to the executable, it behaved in the same way. Is this same in Linux?
image

And could you please give me an example about how do I access the stdin from the WL code?

@rljacobson
Copy link
Author

rljacobson commented Oct 15, 2019

@kenkangxgwe My apologies for missing your question! My GitHub notifications have been overwhelming, and this issue got lost in the crowd.

It appears the command line arguments aren't working at all. Strange. I'll take a look at it.

The original motivation for mathline was to use it with Python's pexpect. Here's an example of how to use pexpect. You would replace

child = pexpect.spawn ('ftp ftp.openbsd.org')

with something like

child = pexpect.spawn ('mathline --usegetline=true')

Of course, this won't work if the command line argument parsing is broken!

@rljacobson
Copy link
Author

@kenkangxgwe I believe I resolved the issue with the command line arguments not being respected. It turns out the issue was only with -i/--inoutstrings. It was printing out the first prompt no matter what but correctly suppressed subsequent prompts when -i true is set. Now it always suppresses prompts if -i true is set.

Hi, please allow me some time to try out MathLine. Btw, is it portable across different platforms so I can bundle it with the server directly?

Yes, I have tested it on macOS and various Linux distros, and it seems to work the same everywhere. I do not have access to a Windows development environment, but the code is standards compliant, so it should be fine. If not, I would love for you to submit a pull request to fix anything.

@kenkangxgwe
Copy link
Owner

kenkangxgwe commented Oct 16, 2019

Thank you @rljacobson , I created a pull request rljacobson/MathLine#4 and maybe you can give me some advice to the last two tasks listed in it. And I also created an issue rljacobson/MathLine#5 that requires the scripting. Thanks!

@kenkangxgwe kenkangxgwe added enhancement New feature or request long-run Works that will be done in the unforeseen future labels Nov 19, 2019
@The3DWizard
Copy link

+1 for the stdio support: I tried to use your language server in jupyter lab via jupyterlab-lsp. Unfortunately they only support stdio connections, so stdio support would be really nice for me and other jupyterlab users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request long-run Works that will be done in the unforeseen future
Projects
None yet
Development

No branches or pull requests

3 participants