xonsh / xontrib-jupyter

Xonsh jupyter kernel allows to run Xonsh shell code in Jupyter, JupyterLab, Euporia, etc.
MIT License
32 stars 4 forks source link

Jupyter Kernel Subprocess do not work on Windows and Mac #1

Closed scopatz closed 10 months ago

scopatz commented 6 years ago

As reported here: https://github.com/xonsh/xonsh/pull/2756#issuecomment-410950907

Expected Behavior

Subprocesses should display their output.

Current Behavior

They do not.

Steps to Reproduce

Run Jupyter on Windows

For community

⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment

eggcaker commented 6 years ago

same on mac osx 10.13.3

scopatz commented 6 years ago

@eggcaker - are you on xonsh 0.7.3?

eggcaker commented 6 years ago

@scopatz yes , installed the 0.7.3 by pip

+------------------+---------------------+
| xonsh            | 0.7.3               |
| Git SHA          | 9bbbf07b            |
| Commit Date      | Aug 2 18:08:44 2018 |
| Python           | 3.6.5               |
| PLY              | 3.9                 |
| have readline    | True                |
| prompt toolkit   | 1.0.15              |
| shell type       | prompt_toolkit1     |
| pygments         | 2.2.0               |
| on posix         | True                |
| on linux         | False               |
| on darwin        | True                |
| on windows       | False               |
| on cygwin        | False               |
| on msys2         | False               |
| is superuser     | False               |
| default encoding | utf-8               |
| xonsh encoding   | utf-8               |
| encoding errors  | surrogateescape     |
+------------------+---------------------+

I'm not sure it's bug or not, when I write ls ~/ in a cell for example, after ran this cell got nothing output, but if i ran files = $(ls ~/), then print (a) the output is correct.

melund commented 6 years ago

when I write ls ~/ in a cell for example, after ran this cell got nothing output, but if i ran files = $(ls ~/), then print (a) the output is correct.

That is also what I see. The python output works well, but subproc output does not work.

scopatz commented 6 years ago

Hmmmm weird! Thanks for letting me know!

ixemad commented 1 year ago

Hi there!

Same behavior in a Linux Ubuntu 20.04 with xonsh 0.14.0, xontrib-jupyter-shell 0.2.0 and Jupyter Lab 4.0.0.

+------------------+---------------------------------------------------------------+
| xonsh            | 0.14.0                                                        |
| Python           | 3.11.3                                                        |
| PLY              | 3.11                                                          |
| have readline    | True                                                          |
| prompt toolkit   | 3.0.38                                                        |
| shell type       | prompt_toolkit                                                |
| history backend  | json                                                          |
| pygments         | 2.15.1                                                        |
| on posix         | True                                                          |
| on linux         | True                                                          |
| distro           | ubuntu                                                        |
| on wsl           | False                                                         |
| on darwin        | False                                                         |
| on windows       | False                                                         |
| on cygwin        | False                                                         |
| on msys2         | False                                                         |
| is superuser     | False                                                         |
| default encoding | utf-8                                                         |
| xonsh encoding   | utf-8                                                         |
| encoding errors  | surrogateescape                                               |
| jupyter          | True                                                          |
| jupyter kernel   | ~/.pyenv/versions/xontrib-jupyter/share/jupyter/kernels/xonsh |
| xontrib 1        | jupyter                                                       |
| RC file 1        | ~/.xonshrc                                                    |
+------------------+---------------------------------------------------------------+

As you can observe below, this is the same behaviour as the one commented by @eggcaker some years ago.

imagen

I also noted that the output for the first cell is printed in the standard output as shown below.

imagen

ixemad commented 10 months ago

Related to my last comment some months ago, you have to set the variable XONSH_CAPTURE_ALWAYS and XONSH_SUBPROC_CAPTURED_PRINT_STDERR to True in order to capture shell output directly into Jupyter. That's easy!

imagen