Search code examples
ipythonspyderstderr

Spyder not showing stderr output in IPython console when running commands with os.system


Setup: MacOS High Sierra, Spyder 3.3.1, Python 2.7.15 64bits, Qt 5.9.4, PyQt5 5.9.2 on Darwin

I run the following code in the IPython console within Spyder:

In [1]: import os
In [2]: os.system("ls")
Out[2]: 0

In [3]: os.system("aasdasd") 
Out[3]: 32512

I can see the output to stdout of the ls command in the bash shell where I run spyder, but not to stderr of the second os.system call that should print sh: asdasd: command not found.

Where does spyder redirect stderr to? Is there a way to see error messages like the one generated in the second case?

Thank you very much!


Solution

  • (Spyder maintainer here) This was fixed in spyder-kernels 0.3.0, the package that provides kernels for our consoles. And by fixed I mean that both stdout and stderr of external commands are now shown directly in our IPython consoles.

    To update spyder-kernels, please close Spyder and run in a system terminal (xterm or Terminal.app, this doesn't work on Windows):

    conda install spyder-kernels=0.*

    if you use Anaconda (it's not available at the moment, but it should be shortly, please wait until it is), or

    pip install spyder-kernels==0.*

    if you use a custom Python installation.