classification
Title: All console message are in the error output in bash interpretor
Type: behavior Stage:
Components: IO Versions: Python 3.8, Python 3.7, Python 3.6, Python 3.4, Python 3.5, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Quentin Millardet, martin.panter, steven.daprano
Priority: normal Keywords:

Created on 2018-05-02 14:24 by Quentin Millardet, last changed 2018-05-05 07:21 by martin.panter.

Files
File name Uploaded Description Edit
Capture d'écran du 2018-05-02 16.16.09.png Quentin Millardet, 2018-05-02 14:24 Screenshot of the problem is clear
Messages (4)
msg316073 - (view) Author: Quentin Millardet (Quentin Millardet) Date: 2018-05-02 14:24
The probleme is all display (normal and error message), in bash, are send to the screen by the error output. So it's impossible when someone make a bash script to get the error back in a log file for exemple, or just to display only the error on a screen.

Problem test on Ubuntu 18.04 and Elementary loki (an Ubuntu 16.04 variant)
msg316075 - (view) Author: Steven D'Aprano (steven.daprano) * (Python committer) Date: 2018-05-02 14:45
Hello Quentin, and welcome.

Please don't post screen shots of text. We don't edit our code with Photoshop, and using a screenshot makes it difficult to copy your code for testing, to verify the bug report, and prevents the blind and visually impaired from taking part on the discussion.

Please copy and paste the code demonstrating the error as text, the output you received, and state the output you expected.
msg316078 - (view) Author: Quentin Millardet (Quentin Millardet) Date: 2018-05-02 14:55
In a bash terminal, obtained result: 

$python > Normal.txt 2> Error.txt
import a
$cat Normal.txt 
$cat Error.txt 
Python 2.7.12 (default, Dec  4 2017, 14:50:18) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named a
>>> 
$


That i was expected  :

$python > Normal.txt 2> Error.txt
import a
$cat Normal.txt 

Python 2.7.12 (default, Dec  4 2017, 14:50:18) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> $cat Error.txt 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named a
$
msg316199 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2018-05-05 07:21
The exception message and stack trace is documented to go to stderr: <https://docs.python.org/2/library/sys.html#sys.excepthook>.

Whether the prompt “>>>” goes to stderr or stdout depends on quirks of the environment. Issue 1927 currently proposes to make it always go to stderr.
History
Date User Action Args
2018-05-05 07:21:24martin.pantersetnosy: + martin.panter
messages: + msg316199
2018-05-02 14:55:13Quentin Millardetsetstatus: pending -> open

messages: + msg316078
2018-05-02 14:45:43steven.dapranosetstatus: open -> pending
nosy: + steven.daprano
messages: + msg316075

2018-05-02 14:27:24Quentin Millardetsetstatus: open
2018-05-02 14:26:47Quentin Millardetsetstatus: open -> (no value)
2018-05-02 14:24:09Quentin Millardetcreate